@mochabug/adaptkit 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +29 -54
- package/package.json +6 -8
package/bin/index.js
CHANGED
|
@@ -2126,7 +2126,7 @@ function useKeypress(userHandler) {
|
|
|
2126
2126
|
const handler = withUpdates((_input, event) => {
|
|
2127
2127
|
if (ignore)
|
|
2128
2128
|
return;
|
|
2129
|
-
signal.current(event, rl);
|
|
2129
|
+
void signal.current(event, rl);
|
|
2130
2130
|
});
|
|
2131
2131
|
rl.input.on('keypress', handler);
|
|
2132
2132
|
return () => {
|
|
@@ -4638,6 +4638,9 @@ var ansiEscapes = /*@__PURE__*/getDefaultExportFromCjs(ansiEscapesExports);
|
|
|
4638
4638
|
|
|
4639
4639
|
const height = (content) => content.split('\n').length;
|
|
4640
4640
|
const lastLine = (content) => content.split('\n').pop() ?? '';
|
|
4641
|
+
function cursorDown(n) {
|
|
4642
|
+
return n > 0 ? ansiEscapes.cursorDown(n) : '';
|
|
4643
|
+
}
|
|
4641
4644
|
class ScreenManager {
|
|
4642
4645
|
rl;
|
|
4643
4646
|
// These variables are keeping information to allow correct prompt re-rendering
|
|
@@ -4649,10 +4652,13 @@ class ScreenManager {
|
|
|
4649
4652
|
this.rl = rl;
|
|
4650
4653
|
this.cursorPos = rl.getCursorPos();
|
|
4651
4654
|
}
|
|
4655
|
+
write(content) {
|
|
4656
|
+
this.rl.output.unmute();
|
|
4657
|
+
this.rl.output.write(content);
|
|
4658
|
+
this.rl.output.mute();
|
|
4659
|
+
}
|
|
4652
4660
|
render(content, bottomContent = '') {
|
|
4653
|
-
|
|
4654
|
-
* Write message to screen and setPrompt to control backspace
|
|
4655
|
-
*/
|
|
4661
|
+
// Write message to screen and setPrompt to control backspace
|
|
4656
4662
|
const promptLine = lastLine(content);
|
|
4657
4663
|
const rawPromptLine = stripAnsi$3(promptLine);
|
|
4658
4664
|
// Remove the rl.line from our prompt. We can't rely on the content of
|
|
@@ -4687,52 +4693,28 @@ class ScreenManager {
|
|
|
4687
4693
|
output += ansiEscapes.cursorUp(bottomContentHeight);
|
|
4688
4694
|
// Return cursor to the initial left offset.
|
|
4689
4695
|
output += ansiEscapes.cursorTo(this.cursorPos.cols);
|
|
4690
|
-
this.clean();
|
|
4691
|
-
this.rl.output.unmute();
|
|
4692
4696
|
/**
|
|
4693
|
-
*
|
|
4697
|
+
* Render and store state for future re-rendering
|
|
4694
4698
|
*/
|
|
4699
|
+
this.write(cursorDown(this.extraLinesUnderPrompt) +
|
|
4700
|
+
ansiEscapes.eraseLines(this.height) +
|
|
4701
|
+
output);
|
|
4695
4702
|
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
4696
4703
|
this.height = height(output);
|
|
4697
|
-
this.rl.output.write(output);
|
|
4698
|
-
this.rl.output.mute();
|
|
4699
4704
|
}
|
|
4700
4705
|
checkCursorPos() {
|
|
4701
4706
|
const cursorPos = this.rl.getCursorPos();
|
|
4702
4707
|
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
4703
|
-
this.
|
|
4704
|
-
this.rl.output.write(ansiEscapes.cursorTo(cursorPos.cols));
|
|
4705
|
-
this.rl.output.mute();
|
|
4708
|
+
this.write(ansiEscapes.cursorTo(cursorPos.cols));
|
|
4706
4709
|
this.cursorPos = cursorPos;
|
|
4707
4710
|
}
|
|
4708
4711
|
}
|
|
4709
|
-
|
|
4710
|
-
this.rl.output.unmute();
|
|
4711
|
-
this.rl.output.write([
|
|
4712
|
-
this.extraLinesUnderPrompt > 0
|
|
4713
|
-
? ansiEscapes.cursorDown(this.extraLinesUnderPrompt)
|
|
4714
|
-
: '',
|
|
4715
|
-
ansiEscapes.eraseLines(this.height),
|
|
4716
|
-
].join(''));
|
|
4717
|
-
this.extraLinesUnderPrompt = 0;
|
|
4718
|
-
this.rl.output.mute();
|
|
4719
|
-
}
|
|
4720
|
-
clearContent() {
|
|
4721
|
-
this.rl.output.unmute();
|
|
4722
|
-
// Reset the cursor at the end of the previously displayed content
|
|
4723
|
-
this.rl.output.write([
|
|
4724
|
-
this.extraLinesUnderPrompt > 0
|
|
4725
|
-
? ansiEscapes.cursorDown(this.extraLinesUnderPrompt)
|
|
4726
|
-
: '',
|
|
4727
|
-
'\n',
|
|
4728
|
-
].join(''));
|
|
4729
|
-
this.rl.output.mute();
|
|
4730
|
-
}
|
|
4731
|
-
done() {
|
|
4712
|
+
done({ clearContent }) {
|
|
4732
4713
|
this.rl.setPrompt('');
|
|
4733
|
-
this.
|
|
4734
|
-
|
|
4735
|
-
|
|
4714
|
+
let output = cursorDown(this.extraLinesUnderPrompt);
|
|
4715
|
+
output += clearContent ? ansiEscapes.eraseLines(this.height) : '\n';
|
|
4716
|
+
output += ansiEscapes.cursorShow;
|
|
4717
|
+
this.write(output);
|
|
4736
4718
|
this.rl.close();
|
|
4737
4719
|
}
|
|
4738
4720
|
}
|
|
@@ -4770,16 +4752,11 @@ function createPrompt(view) {
|
|
|
4770
4752
|
});
|
|
4771
4753
|
function onExit$1() {
|
|
4772
4754
|
hooksCleanup();
|
|
4773
|
-
|
|
4774
|
-
screen.clean();
|
|
4775
|
-
}
|
|
4776
|
-
else {
|
|
4777
|
-
screen.clearContent();
|
|
4778
|
-
}
|
|
4779
|
-
screen.done();
|
|
4755
|
+
screen.done({ clearContent: Boolean(context?.clearPromptOnDone) });
|
|
4780
4756
|
removeExitListener();
|
|
4781
4757
|
rl.input.removeListener('keypress', checkCursorPos);
|
|
4782
4758
|
rl.removeListener('close', hooksCleanup);
|
|
4759
|
+
output.end();
|
|
4783
4760
|
}
|
|
4784
4761
|
cancel = () => {
|
|
4785
4762
|
onExit$1();
|
|
@@ -5340,7 +5317,7 @@ var select = createPrompt((config, done) => {
|
|
|
5340
5317
|
if (Separator.isSeparator(item)) {
|
|
5341
5318
|
return ` ${item.separator}`;
|
|
5342
5319
|
}
|
|
5343
|
-
const line = item.name || item.value;
|
|
5320
|
+
const line = String(item.name || item.value);
|
|
5344
5321
|
if (item.disabled) {
|
|
5345
5322
|
const disabledLabel = typeof item.disabled === 'string' ? item.disabled : '(disabled)';
|
|
5346
5323
|
return theme.style.disabled(`${line} ${disabledLabel}`);
|
|
@@ -7075,7 +7052,7 @@ function printRpcError(error) {
|
|
|
7075
7052
|
}
|
|
7076
7053
|
|
|
7077
7054
|
var name = "@mochabug/adaptkit";
|
|
7078
|
-
var version = "0.10.
|
|
7055
|
+
var version = "0.10.2";
|
|
7079
7056
|
var description = "A cmd to create, emulate and publish Mochabug Adapt plugins";
|
|
7080
7057
|
var main$1 = "bin/index.js";
|
|
7081
7058
|
var type = "module";
|
|
@@ -7120,22 +7097,20 @@ var devDependencies = {
|
|
|
7120
7097
|
"@types/express": "^4.17.21",
|
|
7121
7098
|
"@types/figlet": "^1.5.8",
|
|
7122
7099
|
"@types/jest": "^29.5.12",
|
|
7123
|
-
"@types/mkdirp": "^1.0.2",
|
|
7124
7100
|
"@types/mustache": "^4.2.5",
|
|
7125
|
-
"@types/node": "^22.
|
|
7126
|
-
"@types/sharp": "^0.31.1",
|
|
7101
|
+
"@types/node": "^22.3.0",
|
|
7127
7102
|
"@types/update-notifier": "^6.0.8",
|
|
7128
7103
|
jest: "^29.7.0",
|
|
7129
|
-
rollup: "^4.
|
|
7104
|
+
rollup: "^4.20.0",
|
|
7130
7105
|
"rollup-plugin-string": "^3.0.0",
|
|
7131
|
-
"ts-jest": "^29.2.
|
|
7106
|
+
"ts-jest": "^29.2.4",
|
|
7132
7107
|
"ts-node": "^10.9.2",
|
|
7133
7108
|
tslib: "^2.6.3",
|
|
7134
7109
|
typescript: "^5.5.4"
|
|
7135
7110
|
};
|
|
7136
7111
|
var dependencies = {
|
|
7137
7112
|
"@grpc/grpc-js": "^1.11.1",
|
|
7138
|
-
"@inquirer/prompts": "^5.3.
|
|
7113
|
+
"@inquirer/prompts": "^5.3.8",
|
|
7139
7114
|
"@protobuf-ts/grpc-transport": "^2.9.4",
|
|
7140
7115
|
"@protobuf-ts/runtime": "^2.9.4",
|
|
7141
7116
|
"@protobuf-ts/runtime-rpc": "^2.9.4",
|
|
@@ -7325,7 +7300,7 @@ async function main() {
|
|
|
7325
7300
|
.action(({ host, authority, client, insecure, errorUrl }, cmd) => handlePublish(host, authority, client, insecure, errorUrl, cmd));
|
|
7326
7301
|
program
|
|
7327
7302
|
.command('emulate')
|
|
7328
|
-
.option('-h, --host <host>', 'Specify the URL to test your plugin in the emulator. Ideal for custom port configurations.', 'localhost:
|
|
7303
|
+
.option('-h, --host <host>', 'Specify the URL to test your plugin in the emulator. Ideal for custom port configurations.', 'localhost:51001')
|
|
7329
7304
|
.description('Take your plugin for a test drive. Best used in conjunction with your build pipeline.')
|
|
7330
7305
|
.action(({ host }, cmd) => handleEmulate(host, cmd));
|
|
7331
7306
|
// Set a custom help action
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mochabug/adaptkit",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "A cmd to create, emulate and publish Mochabug Adapt plugins",
|
|
5
5
|
"main": "bin/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -45,22 +45,20 @@
|
|
|
45
45
|
"@types/express": "^4.17.21",
|
|
46
46
|
"@types/figlet": "^1.5.8",
|
|
47
47
|
"@types/jest": "^29.5.12",
|
|
48
|
-
"@types/mkdirp": "^1.0.2",
|
|
49
48
|
"@types/mustache": "^4.2.5",
|
|
50
|
-
"@types/node": "^22.
|
|
51
|
-
"@types/sharp": "^0.31.1",
|
|
49
|
+
"@types/node": "^22.3.0",
|
|
52
50
|
"@types/update-notifier": "^6.0.8",
|
|
53
51
|
"jest": "^29.7.0",
|
|
54
|
-
"rollup": "^4.
|
|
52
|
+
"rollup": "^4.20.0",
|
|
55
53
|
"rollup-plugin-string": "^3.0.0",
|
|
56
|
-
"ts-jest": "^29.2.
|
|
54
|
+
"ts-jest": "^29.2.4",
|
|
57
55
|
"ts-node": "^10.9.2",
|
|
58
56
|
"tslib": "^2.6.3",
|
|
59
57
|
"typescript": "^5.5.4"
|
|
60
58
|
},
|
|
61
59
|
"dependencies": {
|
|
62
60
|
"@grpc/grpc-js": "^1.11.1",
|
|
63
|
-
"@inquirer/prompts": "^5.3.
|
|
61
|
+
"@inquirer/prompts": "^5.3.8",
|
|
64
62
|
"@protobuf-ts/grpc-transport": "^2.9.4",
|
|
65
63
|
"@protobuf-ts/runtime": "^2.9.4",
|
|
66
64
|
"@protobuf-ts/runtime-rpc": "^2.9.4",
|
|
@@ -78,4 +76,4 @@
|
|
|
78
76
|
"sharp": "^0.33.4",
|
|
79
77
|
"update-notifier": "^7.2.0"
|
|
80
78
|
}
|
|
81
|
-
}
|
|
79
|
+
}
|