@tui-sandbox/library 11.6.6 → 11.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/browser/assets/{index-BanBEC6y.js → index-CQ6TDc4S.js} +7 -7
- package/dist/browser/index.html +1 -1
- package/dist/src/scripts/commands/commandTuiNeovimExec.d.ts +2 -1
- package/dist/src/scripts/commands/commandTuiNeovimExec.js +1 -2
- package/dist/src/scripts/commands/commandTuiNeovimExec.js.map +1 -1
- package/dist/src/scripts/commands/commandTuiNeovimPrepare.d.ts +2 -1
- package/dist/src/scripts/commands/commandTuiNeovimPrepare.js +1 -2
- package/dist/src/scripts/commands/commandTuiNeovimPrepare.js.map +1 -1
- package/dist/src/scripts/commands/commandTuiStart.d.ts +2 -1
- package/dist/src/scripts/commands/commandTuiStart.js +2 -2
- package/dist/src/scripts/commands/commandTuiStart.js.map +1 -1
- package/dist/src/scripts/resolveConfig.test.d.ts +1 -0
- package/dist/src/scripts/resolveConfig.test.js +144 -0
- package/dist/src/scripts/resolveConfig.test.js.map +1 -0
- package/dist/src/scripts/resolveTuiConfig.d.ts +13 -0
- package/dist/src/scripts/resolveTuiConfig.js +43 -0
- package/dist/src/scripts/resolveTuiConfig.js.map +1 -0
- package/dist/src/scripts/tui.d.ts +0 -7
- package/dist/src/scripts/tui.js +11 -13
- package/dist/src/scripts/tui.js.map +1 -1
- package/dist/src/server/applications/neovim/environment/TempDirectory.d.ts +7 -0
- package/dist/src/server/applications/neovim/environment/TempDirectory.js +17 -0
- package/dist/src/server/applications/neovim/environment/TempDirectory.js.map +1 -0
- package/dist/src/server/applications/neovim/environment/createTempDir.test.js +1 -15
- package/dist/src/server/applications/neovim/environment/createTempDir.test.js.map +1 -1
- package/dist/src/server/config.d.ts +2 -0
- package/dist/src/server/config.js +9 -0
- package/dist/src/server/config.js.map +1 -0
- package/dist/src/server/updateTestdirectorySchemaFile.d.ts +10 -8
- package/dist/src/server/updateTestdirectorySchemaFile.js +8 -0
- package/dist/src/server/updateTestdirectorySchemaFile.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/scripts/commands/commandTuiNeovimExec.ts +2 -2
- package/src/scripts/commands/commandTuiNeovimPrepare.ts +2 -2
- package/src/scripts/commands/commandTuiStart.ts +3 -2
- package/src/scripts/resolveConfig.test.ts +73 -0
- package/src/scripts/resolveTuiConfig.ts +59 -0
- package/src/scripts/tui.ts +11 -15
- package/src/server/applications/neovim/environment/TempDirectory.ts +18 -0
- package/src/server/applications/neovim/environment/createTempDir.test.ts +2 -17
- package/src/server/config.ts +11 -0
- package/src/server/updateTestdirectorySchemaFile.ts +10 -8
package/dist/browser/index.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<title>tui-sandbox integration tests</title>
|
|
6
|
-
<script type="module" crossorigin src="/assets/index-
|
|
6
|
+
<script type="module" crossorigin src="/assets/index-CQ6TDc4S.js"></script>
|
|
7
7
|
<link rel="stylesheet" crossorigin href="/assets/index-BYvynUT_.css">
|
|
8
8
|
</head>
|
|
9
9
|
<body>
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import type { TestServerConfig } from "../../server/updateTestdirectorySchemaFile.js";
|
|
1
2
|
import type { NeovimExec } from "../parseArguments.js";
|
|
2
|
-
export declare function commandTuiNeovimExec(command: NeovimExec): Promise<void>;
|
|
3
|
+
export declare function commandTuiNeovimExec(command: NeovimExec, config: TestServerConfig): Promise<void>;
|
|
@@ -52,8 +52,7 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
52
52
|
});
|
|
53
53
|
import { NeovimApplication } from "../../server/applications/neovim/NeovimApplication.js";
|
|
54
54
|
import { prepareNewTestDirectory } from "../../server/applications/neovim/prepareNewTestDirectory.js";
|
|
55
|
-
|
|
56
|
-
export async function commandTuiNeovimExec(command) {
|
|
55
|
+
export async function commandTuiNeovimExec(command, config) {
|
|
57
56
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
58
57
|
try {
|
|
59
58
|
// automatically dispose of the neovim instance when done
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandTuiNeovimExec.js","sourceRoot":"","sources":["../../../../src/scripts/commands/commandTuiNeovimExec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAA8B,MAAM,uDAAuD,CAAA;AACrH,OAAO,EAAE,uBAAuB,EAAE,MAAM,6DAA6D,CAAA;
|
|
1
|
+
{"version":3,"file":"commandTuiNeovimExec.js","sourceRoot":"","sources":["../../../../src/scripts/commands/commandTuiNeovimExec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAA8B,MAAM,uDAAuD,CAAA;AACrH,OAAO,EAAE,uBAAuB,EAAE,MAAM,6DAA6D,CAAA;AAIrG,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAmB,EAAE,MAAwB;;;QACtF,yDAAyD;QACzD,MAAY,GAAG,kCAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,mBAAmB,CAAC,OAAA,CAAA;QAC/E,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,QAAwC,EAAE,IAAI,CAAC,EAAE;YAC7D,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAA;QACzC,CAAC,CAAC,CAAA;QACF,MAAM,aAAa,GAAG,MAAM,uBAAuB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;QACvE,MAAM,GAAG,CAAC,uBAAuB,CAC/B,aAAa,EACb;YACE,QAAQ,EAAE,WAAW;YACrB,WAAW,EAAE,OAAO,CAAC,OAAO;YAC5B,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;SAC1C,EACD,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CACvB,CAAA;QACD,MAAM,GAAG,CAAC,WAAW,CAAC,SAAS,EAAE,CAAA;;;;;;;;;;;CAClC"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { TestServerConfig } from "../../server/updateTestdirectorySchemaFile.js";
|
|
2
|
+
export declare function commandTuiNeovimPrepare(config: TestServerConfig): Promise<void>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { installDependencies } from "../../server/applications/neovim/api.js";
|
|
2
|
-
|
|
3
|
-
export async function commandTuiNeovimPrepare() {
|
|
2
|
+
export async function commandTuiNeovimPrepare(config) {
|
|
4
3
|
const NVIM_APPNAME = process.env["NVIM_APPNAME"];
|
|
5
4
|
console.log(`🚀 Installing neovim dependencies${NVIM_APPNAME ? ` for NVIM_APPNAME=${NVIM_APPNAME}` : ""}...`);
|
|
6
5
|
await installDependencies(config.directories.testEnvironmentPath, process.env["NVIM_APPNAME"], config.directories).catch((err) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandTuiNeovimPrepare.js","sourceRoot":"","sources":["../../../../src/scripts/commands/commandTuiNeovimPrepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;
|
|
1
|
+
{"version":3,"file":"commandTuiNeovimPrepare.js","sourceRoot":"","sources":["../../../../src/scripts/commands/commandTuiNeovimPrepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAG7E,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,MAAwB;IACpE,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;IAChD,OAAO,CAAC,GAAG,CAAC,oCAAoC,YAAY,CAAC,CAAC,CAAC,qBAAqB,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;IAC7G,MAAM,mBAAmB,CACvB,MAAM,CAAC,WAAW,CAAC,mBAAmB,EACtC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAC3B,MAAM,CAAC,WAAW,CACnB,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;QACvB,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAA;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC,CAAA;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { TestServerConfig } from "../../server/updateTestdirectorySchemaFile.js";
|
|
2
|
+
export declare function commandTuiStart(config: TestServerConfig): Promise<void>;
|
|
@@ -2,8 +2,8 @@ import path from "path";
|
|
|
2
2
|
import { createCypressSupportFile } from "../../server/cypress-support/createCypressSupportFile.js";
|
|
3
3
|
import { startTestServer } from "../../server/server.js";
|
|
4
4
|
import { updateTestdirectorySchemaFile } from "../../server/updateTestdirectorySchemaFile.js";
|
|
5
|
-
import {
|
|
6
|
-
export async function commandTuiStart() {
|
|
5
|
+
import { cwd } from "../tui.js";
|
|
6
|
+
export async function commandTuiStart(config) {
|
|
7
7
|
try {
|
|
8
8
|
await createCypressSupportFile({
|
|
9
9
|
cypressSupportDirectoryPath: path.join(cwd, "cypress", "support"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandTuiStart.js","sourceRoot":"","sources":["../../../../src/scripts/commands/commandTuiStart.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAA;AACnG,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"commandTuiStart.js","sourceRoot":"","sources":["../../../../src/scripts/commands/commandTuiStart.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAA;AACnG,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAA;AAC7F,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAE/B,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAwB;IAC5D,IAAI,CAAC;QACH,MAAM,wBAAwB,CAAC;YAC7B,2BAA2B,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC;YACjE,eAAe,EAAE,gBAAgB;SAClC,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,CAAC,CAAC,CAAA;IACxD,CAAC;IAED,IAAI,CAAC;QACH,MAAM,6BAA6B,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;IACzD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,CAAC,CAAC,CAAA;IAC7D,CAAC;IAED,IAAI,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,8BAA8B,GAAG,qEAAqE,CAAC,CAAA;QACnH,MAAM,eAAe,CAAC,MAAM,CAAC,CAAA;IAC/B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,CAAC,CAAC,CAAA;IAC/C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
53
|
+
import assert from "assert";
|
|
54
|
+
import { writeFile } from "fs/promises";
|
|
55
|
+
import { expect } from "vitest";
|
|
56
|
+
import { TempDirectory } from "../server/applications/neovim/environment/TempDirectory.js";
|
|
57
|
+
import { testServerConfigSchema } from "../server/updateTestdirectorySchemaFile.js";
|
|
58
|
+
import { resolveTuiConfig } from "./resolveTuiConfig.js";
|
|
59
|
+
it("defaults to the default configuration if no config file is found", async () => {
|
|
60
|
+
const config = await resolveTuiConfig(__dirname);
|
|
61
|
+
assert(!config.error);
|
|
62
|
+
expect(config.id).toBe("no-config-found");
|
|
63
|
+
expect(testServerConfigSchema.safeParse(config.result).success).toBe(true);
|
|
64
|
+
});
|
|
65
|
+
it("loads a custom configuration file if it exists", async () => {
|
|
66
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
67
|
+
try {
|
|
68
|
+
const dir = __addDisposableResource(env_1, TempDirectory.create(), false);
|
|
69
|
+
const customConfig = {
|
|
70
|
+
directories: {
|
|
71
|
+
testEnvironmentPath: "./test-environment2/",
|
|
72
|
+
outputFilePath: "./output.ts",
|
|
73
|
+
},
|
|
74
|
+
port: 12345,
|
|
75
|
+
};
|
|
76
|
+
{
|
|
77
|
+
const filename = `${dir.path}/tui-sandbox.config.ts`;
|
|
78
|
+
const contents = `export const config = ${JSON.stringify(customConfig)}`;
|
|
79
|
+
await writeFile(filename, contents);
|
|
80
|
+
}
|
|
81
|
+
const config = await resolveTuiConfig(dir.path);
|
|
82
|
+
expect(config).toStrictEqual({
|
|
83
|
+
id: "custom-config",
|
|
84
|
+
result: customConfig,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
catch (e_1) {
|
|
88
|
+
env_1.error = e_1;
|
|
89
|
+
env_1.hasError = true;
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
__disposeResources(env_1);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
it("uses the default configuration file if the config has invalid contents", async () => {
|
|
96
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
97
|
+
try {
|
|
98
|
+
const dir = __addDisposableResource(env_2, TempDirectory.create(), false);
|
|
99
|
+
{
|
|
100
|
+
const customConfig = {
|
|
101
|
+
// @ts-expect-error testing an invalid config on purpose
|
|
102
|
+
directories: undefined,
|
|
103
|
+
port: 12345,
|
|
104
|
+
};
|
|
105
|
+
const filename = `${dir.path}/tui-sandbox.config.ts`;
|
|
106
|
+
const contents = `export const config = ${JSON.stringify(customConfig)}`;
|
|
107
|
+
await writeFile(filename, contents);
|
|
108
|
+
}
|
|
109
|
+
const result = await resolveTuiConfig(dir.path);
|
|
110
|
+
assert(result.error);
|
|
111
|
+
expect(result.configFilePath).contains(dir.path);
|
|
112
|
+
expect(result.message).match(/Issues found in the config file/);
|
|
113
|
+
}
|
|
114
|
+
catch (e_2) {
|
|
115
|
+
env_2.error = e_2;
|
|
116
|
+
env_2.hasError = true;
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
__disposeResources(env_2);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
it("fails if the config has not been exported from the config file", async () => {
|
|
123
|
+
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
124
|
+
try {
|
|
125
|
+
const dir = __addDisposableResource(env_3, TempDirectory.create(), false);
|
|
126
|
+
{
|
|
127
|
+
const filename = `${dir.path}/tui-sandbox.config.ts`;
|
|
128
|
+
const contents = ``;
|
|
129
|
+
await writeFile(filename, contents);
|
|
130
|
+
}
|
|
131
|
+
const result = await resolveTuiConfig(dir.path);
|
|
132
|
+
assert(result.error);
|
|
133
|
+
expect(result.configFilePath).contains(dir.path);
|
|
134
|
+
expect(result.message).match(/Issues found in the config file/);
|
|
135
|
+
}
|
|
136
|
+
catch (e_3) {
|
|
137
|
+
env_3.error = e_3;
|
|
138
|
+
env_3.hasError = true;
|
|
139
|
+
}
|
|
140
|
+
finally {
|
|
141
|
+
__disposeResources(env_3);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
//# sourceMappingURL=resolveConfig.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveConfig.test.js","sourceRoot":"","sources":["../../../src/scripts/resolveConfig.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,4DAA4D,CAAA;AAE1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAA;AAEnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,EAAE,CAAC,kEAAkE,EAAE,KAAK,IAAI,EAAE;IAChF,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,SAAS,CAAC,CAAA;IAChD,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACrB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,iBAA+D,CAAC,CAAA;IACvF,MAAM,CAAC,sBAAsB,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC5E,CAAC,CAAC,CAAA;AAEF,EAAE,CAAC,gDAAgD,EAAE,KAAK,IAAI,EAAE;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M,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAChD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAA;;;;;;;;;CAChE,CAAC,CAAA;AAEF,EAAE,CAAC,gEAAgE,EAAE,KAAK,IAAI,EAAE;;;QAC9E,MAAM,GAAG,kCAAG,aAAa,CAAC,MAAM,EAAE,QAAA,CAAA;QAElC,CAAC;YACC,MAAM,QAAQ,GAAG,GAAG,GAAG,CAAC,IAAI,wBAAwB,CAAA;YACpD,MAAM,QAAQ,GAAG,EAAE,CAAA;YACnB,MAAM,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QACrC,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAC/C,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACpB,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAChD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAA;;;;;;;;;CAChE,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type TestServerConfig } from "../server/updateTestdirectorySchemaFile.js";
|
|
2
|
+
export type ResolveTuiConfigResultSuccess = {
|
|
3
|
+
id: "default-config" | "custom-config" | "no-config-found";
|
|
4
|
+
result: TestServerConfig;
|
|
5
|
+
error?: never;
|
|
6
|
+
};
|
|
7
|
+
export type ResolveTuiConfigResultError = {
|
|
8
|
+
error: object;
|
|
9
|
+
configFilePath: string;
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
export type ResolveTuiConfigResult = ResolveTuiConfigResultSuccess | ResolveTuiConfigResultError;
|
|
13
|
+
export declare const resolveTuiConfig: (cwd: string) => Promise<ResolveTuiConfigResult>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import assert from "assert";
|
|
2
|
+
import { resolve } from "path/posix";
|
|
3
|
+
import { pathToFileURL } from "url";
|
|
4
|
+
import { debuglog } from "util";
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { createDefaultConfig } from "../server/config.js";
|
|
7
|
+
import { testServerConfigSchema } from "../server/updateTestdirectorySchemaFile.js";
|
|
8
|
+
const log = debuglog("tui-sandbox.resolveConfig");
|
|
9
|
+
export const resolveTuiConfig = async (cwd) => {
|
|
10
|
+
const defaultConfig = createDefaultConfig(cwd, process.env);
|
|
11
|
+
const url = pathToFileURL(resolve(cwd, "tui-sandbox.config.ts"));
|
|
12
|
+
let file;
|
|
13
|
+
try {
|
|
14
|
+
// loading typescript files works when using https://tsx.is/
|
|
15
|
+
file = await import(url.href);
|
|
16
|
+
log(`Found configuration file in ${url.pathname}:`, JSON.stringify(file, null, 2));
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
console.log("Using the default configuration.");
|
|
20
|
+
log("Config load error:", e);
|
|
21
|
+
return {
|
|
22
|
+
id: "no-config-found",
|
|
23
|
+
result: defaultConfig,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
assert(file);
|
|
27
|
+
const customConfigSchema = z.strictObject({ config: testServerConfigSchema });
|
|
28
|
+
const customConfig = customConfigSchema.safeParse(file);
|
|
29
|
+
if (customConfig.success) {
|
|
30
|
+
return {
|
|
31
|
+
id: "custom-config",
|
|
32
|
+
result: customConfig.data.config,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return {
|
|
37
|
+
error: z.treeifyError(customConfig.error),
|
|
38
|
+
configFilePath: url.pathname,
|
|
39
|
+
message: `Issues found in the config file`,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=resolveTuiConfig.js.map
|
|
@@ -0,0 +1 @@
|
|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CAAC,CAAA;IACZ,MAAM,kBAAkB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAAE,CAAC,CAAA;IAC7E,MAAM,YAAY,GAAG,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IACvD,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;QACzB,OAAO;YACL,EAAE,EAAE,eAAe;YACnB,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,MAAM;SACjC,CAAA;IACH,CAAC;SAAM,CAAC;QACN,OAAO;YACL,KAAK,EAAE,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC;YACzC,cAAc,EAAE,GAAG,CAAC,QAAQ;YAC5B,OAAO,EAAE,iCAAiC;SAC3C,CAAA;IACH,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
/** The cwd in the user's directory when they are running this script. Not the
|
|
2
2
|
* cwd of the script itself. */
|
|
3
3
|
export declare const cwd: string;
|
|
4
|
-
export declare const config: {
|
|
5
|
-
directories: {
|
|
6
|
-
testEnvironmentPath: string;
|
|
7
|
-
outputFilePath: string;
|
|
8
|
-
};
|
|
9
|
-
port: number;
|
|
10
|
-
};
|
package/dist/src/scripts/tui.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import assert from "node:assert";
|
|
2
|
-
import path from "node:path";
|
|
3
2
|
import { commandRun } from "./commands/commandRun.js";
|
|
4
3
|
import { commandTuiNeovimExec } from "./commands/commandTuiNeovimExec.js";
|
|
5
4
|
import { commandTuiNeovimPrepare } from "./commands/commandTuiNeovimPrepare.js";
|
|
6
5
|
import { commandTuiStart } from "./commands/commandTuiStart.js";
|
|
7
6
|
import { parseArguments } from "./parseArguments.js";
|
|
7
|
+
import { resolveTuiConfig } from "./resolveTuiConfig.js";
|
|
8
8
|
//
|
|
9
9
|
// This is the main entrypoint to tui-sandbox
|
|
10
10
|
//
|
|
@@ -15,31 +15,28 @@ if (major < 24) {
|
|
|
15
15
|
console.error(`tui-sandbox error: Node.js >= 24.0.0 is required. You are using ${process.version}.`);
|
|
16
16
|
process.exit(1);
|
|
17
17
|
}
|
|
18
|
-
const outputFileName = "MyTestDirectory.ts";
|
|
19
18
|
/** The cwd in the user's directory when they are running this script. Not the
|
|
20
19
|
* cwd of the script itself. */
|
|
21
20
|
export const cwd = process.cwd();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
port: process.env["PORT"] ? parseInt(process.env["PORT"]) : 3000,
|
|
28
|
-
};
|
|
21
|
+
const configResult = await resolveTuiConfig(cwd);
|
|
22
|
+
if (configResult.error) {
|
|
23
|
+
console.error(configResult.message, configResult.error);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
29
26
|
// the arguments passed to this script start at index 2
|
|
30
27
|
const args = process.argv.slice(2);
|
|
31
28
|
const command = await parseArguments(args);
|
|
32
29
|
switch (command?.action) {
|
|
33
30
|
case "neovim prepare": {
|
|
34
|
-
await commandTuiNeovimPrepare();
|
|
31
|
+
await commandTuiNeovimPrepare(configResult.result);
|
|
35
32
|
break;
|
|
36
33
|
}
|
|
37
34
|
case "neovim exec": {
|
|
38
|
-
await commandTuiNeovimExec(command);
|
|
35
|
+
await commandTuiNeovimExec(command, configResult.result);
|
|
39
36
|
break;
|
|
40
37
|
}
|
|
41
38
|
case "start": {
|
|
42
|
-
await commandTuiStart();
|
|
39
|
+
await commandTuiStart(configResult.result);
|
|
43
40
|
break;
|
|
44
41
|
}
|
|
45
42
|
case "run": {
|
|
@@ -47,7 +44,8 @@ switch (command?.action) {
|
|
|
47
44
|
// important:
|
|
48
45
|
//
|
|
49
46
|
// This is what determines if the test run was successful or not.
|
|
50
|
-
process.
|
|
47
|
+
process.exitCode = typeof result === "number" ? result : 1;
|
|
48
|
+
break;
|
|
51
49
|
}
|
|
52
50
|
default: {
|
|
53
51
|
command;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui.js","sourceRoot":"","sources":["../../../src/scripts/tui.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"tui.js","sourceRoot":"","sources":["../../../src/scripts/tui.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAA;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAA;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,EAAE;AACF,6CAA6C;AAC7C,EAAE;AAEF,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AAC5D,MAAM,CAAC,KAAK,CAAC,CAAA;AACb,MAAM,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;AAErB,IAAI,KAAK,GAAG,EAAE,EAAE,CAAC;IACf,OAAO,CAAC,KAAK,CAAC,mEAAmE,OAAO,CAAC,OAAO,GAAG,CAAC,CAAA;IACpG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC;AAED;+BAC+B;AAC/B,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;AAChC,MAAM,YAAY,GAAG,MAAM,gBAAgB,CAAC,GAAG,CAAC,CAAA;AAChD,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC;IACvB,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAA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1,17 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import nodePath from "path";
|
|
3
|
+
export class TempDirectory {
|
|
4
|
+
path;
|
|
5
|
+
constructor(path) {
|
|
6
|
+
this.path = path;
|
|
7
|
+
}
|
|
8
|
+
static create() {
|
|
9
|
+
const tmp = fs.mkdtempSync("test-temp-dir-");
|
|
10
|
+
const absolutePath = nodePath.resolve(tmp);
|
|
11
|
+
return new TempDirectory(absolutePath);
|
|
12
|
+
}
|
|
13
|
+
[Symbol.dispose]() {
|
|
14
|
+
fs.rmdirSync(this.path, { recursive: true, maxRetries: 5 });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=TempDirectory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TempDirectory.js","sourceRoot":"","sources":["../../../../../../src/server/applications/neovim/environment/TempDirectory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,QAAQ,MAAM,MAAM,CAAA;AAI3B,MAAM,OAAO,aAAa;IACY;IAApC,YAAoC,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAE7C,MAAM,CAAC,MAAM;QAClB,MAAM,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,gBAA4C,CAAC,CAAA;QACxE,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QAC1C,OAAO,IAAI,aAAa,CAAC,YAAY,CAAC,CAAA;IACxC,CAAC;IAED,CAAC,MAAM,CAAC,OAAO,CAAC;QACd,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAA;IAC7D,CAAC;CACF"}
|
|
@@ -50,25 +50,11 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
50
50
|
var e = new Error(message);
|
|
51
51
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
52
|
});
|
|
53
|
-
import fs from "fs";
|
|
54
53
|
import nodePath from "path";
|
|
55
54
|
import { expect, it, vi } from "vitest";
|
|
56
55
|
import { createTempDir } from "./createTempDir.js";
|
|
56
|
+
import { TempDirectory } from "./TempDirectory.js";
|
|
57
57
|
vi.spyOn(console, "log").mockImplementation(vi.fn());
|
|
58
|
-
class TempDirectory {
|
|
59
|
-
path;
|
|
60
|
-
constructor(path) {
|
|
61
|
-
this.path = path;
|
|
62
|
-
}
|
|
63
|
-
static create() {
|
|
64
|
-
const tmp = fs.mkdtempSync("test-temp-dir-");
|
|
65
|
-
const absolutePath = nodePath.resolve(tmp);
|
|
66
|
-
return new TempDirectory(absolutePath);
|
|
67
|
-
}
|
|
68
|
-
[Symbol.dispose]() {
|
|
69
|
-
fs.rmdirSync(this.path, { recursive: true, maxRetries: 5 });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
58
|
it("should create a temp dir with no contents", async () => {
|
|
73
59
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
74
60
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTempDir.test.js","sourceRoot":"","sources":["../../../../../../src/server/applications/neovim/environment/createTempDir.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"createTempDir.test.js","sourceRoot":"","sources":["../../../../../../src/server/applications/neovim/environment/createTempDir.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;AAEpD,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;;;QACzD,iFAAiF;QACjF,MAAM,GAAG,kCAAG,aAAa,CAAC,MAAM,EAAE,QAAA,CAAA;QAClC,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;YACjC,mBAAmB,EAAE,GAAG,CAAC,IAAI;YAC7B,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,oBAAoB,CAAC;SAC9D,CAAC,CAAA;QAEF,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QACnC,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACpD,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,gBAA4C,CAAC,CAAC,CAAC,UAAU,EAAE,CAAA;QACtG,MAAM,CAAC,MAAM,CAAC,2BAA2B,CAAC,QAAQ,CAAC,UAAiC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAA;;;;;;;;;CACpG,CAAC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
export const createDefaultConfig = (cwd, environment) => ({
|
|
3
|
+
directories: {
|
|
4
|
+
testEnvironmentPath: path.join(cwd, "test-environment/"),
|
|
5
|
+
outputFilePath: path.join(cwd, "MyTestDirectory.ts"),
|
|
6
|
+
},
|
|
7
|
+
port: environment["PORT"] ? parseInt(environment["PORT"]) : 3000,
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/server/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAGvB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAW,EAAE,WAA8B,EAAoB,EAAE,CACnG,CAAC;IACC,WAAW,EAAE;QACX,mBAAmB,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,mBAAmB,CAAC;QACxD,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,oBAAoB,CAAC;KACrD;IACD,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;CACjE,CAA4B,CAAA"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
export type DirectoriesConfig = TestServerConfig["directories"];
|
|
3
|
+
export type TestServerConfig = z.output<typeof testServerConfigSchema>;
|
|
4
|
+
export declare const testServerConfigSchema: z.ZodObject<{
|
|
5
|
+
directories: z.ZodObject<{
|
|
6
|
+
testEnvironmentPath: z.ZodString;
|
|
7
|
+
outputFilePath: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
port: z.ZodNumber;
|
|
10
|
+
}, z.core.$strict>;
|
|
9
11
|
export type UpdateTestdirectorySchemaFileResult = "updated" | "did-nothing";
|
|
10
12
|
export declare function updateTestdirectorySchemaFile({ testEnvironmentPath, outputFilePath, }: DirectoriesConfig): Promise<UpdateTestdirectorySchemaFileResult>;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync } from "fs";
|
|
2
2
|
import { debuglog } from "util";
|
|
3
|
+
import * as z from "zod";
|
|
3
4
|
import { buildTestDirectorySchema } from "./dirtree/index.js";
|
|
4
5
|
const log = debuglog("tui-sandbox.updateTestdirectorySchemaFile");
|
|
6
|
+
export const testServerConfigSchema = z.strictObject({
|
|
7
|
+
directories: z.object({
|
|
8
|
+
testEnvironmentPath: z.string(),
|
|
9
|
+
outputFilePath: z.string(),
|
|
10
|
+
}),
|
|
11
|
+
port: z.number().int().min(1).max(65535),
|
|
12
|
+
});
|
|
5
13
|
export async function updateTestdirectorySchemaFile({ testEnvironmentPath, outputFilePath, }) {
|
|
6
14
|
const newSchema = await buildTestDirectorySchema(testEnvironmentPath);
|
|
7
15
|
let oldSchema = "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateTestdirectorySchemaFile.js","sourceRoot":"","sources":["../../../src/server/updateTestdirectorySchemaFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAE7D,MAAM,GAAG,GAAG,QAAQ,CAAC,2CAA2C,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"updateTestdirectorySchemaFile.js","sourceRoot":"","sources":["../../../src/server/updateTestdirectorySchemaFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAE7D,MAAM,GAAG,GAAG,QAAQ,CAAC,2CAA2C,CAAC,CAAA;AAKjE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,YAAY,CAAC;IACnD,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,mBAAmB,EAAE,CAAC,CAAC,M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