starlight-cli 1.0.14 → 1.0.15
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/index.js +7 -39
- package/package.json +1 -1
- package/src/starlight.js +7 -31
package/dist/index.js
CHANGED
|
@@ -25775,14 +25775,6 @@ module.exports = require("path");
|
|
|
25775
25775
|
|
|
25776
25776
|
/***/ }),
|
|
25777
25777
|
|
|
25778
|
-
/***/ 3785:
|
|
25779
|
-
/***/ ((module) => {
|
|
25780
|
-
|
|
25781
|
-
"use strict";
|
|
25782
|
-
module.exports = require("readline");
|
|
25783
|
-
|
|
25784
|
-
/***/ }),
|
|
25785
|
-
|
|
25786
25778
|
/***/ 3193:
|
|
25787
25779
|
/***/ ((module) => {
|
|
25788
25780
|
|
|
@@ -25850,14 +25842,14 @@ const fs = __nccwpck_require__(9896);
|
|
|
25850
25842
|
const path = __nccwpck_require__(6928);
|
|
25851
25843
|
const os = __nccwpck_require__(857);
|
|
25852
25844
|
const { exec } = __nccwpck_require__(5317);
|
|
25853
|
-
const readline = __nccwpck_require__(3785);
|
|
25854
25845
|
const readlineSync = __nccwpck_require__(552);
|
|
25855
25846
|
const blessed = __nccwpck_require__(4796);
|
|
25847
|
+
|
|
25856
25848
|
const Lexer = __nccwpck_require__(5211);
|
|
25857
25849
|
const Parser = __nccwpck_require__(2222);
|
|
25858
25850
|
const Evaluator = __nccwpck_require__(8112);
|
|
25859
25851
|
|
|
25860
|
-
const VERSION = '1.0.
|
|
25852
|
+
const VERSION = '1.0.15';
|
|
25861
25853
|
|
|
25862
25854
|
const COLOR = {
|
|
25863
25855
|
reset: '\x1b[0m',
|
|
@@ -25871,7 +25863,6 @@ const COLOR = {
|
|
|
25871
25863
|
magenta: '\x1b[35m'
|
|
25872
25864
|
};
|
|
25873
25865
|
|
|
25874
|
-
|
|
25875
25866
|
function waitAndExit(code = 0) {
|
|
25876
25867
|
try { process.stdin.setRawMode(true); } catch {}
|
|
25877
25868
|
console.error(COLOR.gray + '\nPress any key to exit...' + COLOR.reset);
|
|
@@ -25884,21 +25875,13 @@ function fatal(msg) {
|
|
|
25884
25875
|
waitAndExit(1);
|
|
25885
25876
|
}
|
|
25886
25877
|
|
|
25887
|
-
|
|
25888
|
-
|
|
25889
|
-
return line
|
|
25890
|
-
// strings
|
|
25878
|
+
function highlightCode(text) {
|
|
25879
|
+
return text
|
|
25891
25880
|
.replace(/"(?:\\.|[^"])*"/g, m => COLOR.yellow + m + COLOR.reset)
|
|
25892
|
-
// numbers
|
|
25893
25881
|
.replace(/\b\d+(\.\d+)?\b/g, m => COLOR.magenta + m + COLOR.reset)
|
|
25894
|
-
|
|
25895
|
-
.replace(
|
|
25896
|
-
/\b(sldeploy|import|from|const|let|var|if|else|for|while|func|return|break|continue|define|ask)\b/g,
|
|
25897
|
-
m => COLOR.blue + m + COLOR.reset
|
|
25898
|
-
);
|
|
25882
|
+
.replace(/\b(sldeploy|import|from|const|let|var|if|else|for|while|func|return|break|continue|define|ask)\b/g, m => COLOR.blue + m + COLOR.reset);
|
|
25899
25883
|
}
|
|
25900
25884
|
|
|
25901
|
-
|
|
25902
25885
|
const args = process.argv.slice(2);
|
|
25903
25886
|
|
|
25904
25887
|
if (args.length === 0) {
|
|
@@ -25934,9 +25917,7 @@ if (args[0] === '--learn') {
|
|
|
25934
25917
|
process.exit(0);
|
|
25935
25918
|
}
|
|
25936
25919
|
|
|
25937
|
-
|
|
25938
25920
|
if (args[0] === '--writedirectly') {
|
|
25939
|
-
const blessed = __nccwpck_require__(4796);
|
|
25940
25921
|
const tempFile = path.join(os.tmpdir(), `starlight-${Date.now()}.sl`);
|
|
25941
25922
|
|
|
25942
25923
|
const screen = blessed.screen({
|
|
@@ -25985,19 +25966,14 @@ if (args[0] === '--writedirectly') {
|
|
|
25985
25966
|
editor.focus();
|
|
25986
25967
|
screen.render();
|
|
25987
25968
|
|
|
25988
|
-
function highlightCode(text) {
|
|
25989
|
-
return text
|
|
25990
|
-
.replace(/"(.*?)"/g, '{yellow-fg}"$1"{/}')
|
|
25991
|
-
.replace(/\b\d+(\.\d+)?\b/g, '{magenta-fg}$&{/}')
|
|
25992
|
-
.replace(/\b(sldeploy|import|from|const|let|var|if|else|for|while|func|return|break|continue|define|ask)\b/g, '{blue-fg}$1{/}');
|
|
25993
|
-
}
|
|
25994
|
-
|
|
25995
25969
|
screen.key(['C-q'], () => screen.destroy());
|
|
25970
|
+
|
|
25996
25971
|
screen.key(['C-s'], () => {
|
|
25997
25972
|
fs.writeFileSync(tempFile, editor.getValue());
|
|
25998
25973
|
output.setContent(' Saved ');
|
|
25999
25974
|
screen.render();
|
|
26000
25975
|
});
|
|
25976
|
+
|
|
26001
25977
|
screen.key(['C-r'], () => {
|
|
26002
25978
|
fs.writeFileSync(tempFile, editor.getValue());
|
|
26003
25979
|
output.setContent(' Running... ');
|
|
@@ -26009,18 +25985,10 @@ if (args[0] === '--writedirectly') {
|
|
|
26009
25985
|
});
|
|
26010
25986
|
});
|
|
26011
25987
|
|
|
26012
|
-
editor.on('keypress', () => {
|
|
26013
|
-
const cursor = editor.getCursor();
|
|
26014
|
-
editor.setValue(highlightCode(editor.getValue()));
|
|
26015
|
-
editor.move(cursor.y, cursor.x);
|
|
26016
|
-
screen.render();
|
|
26017
|
-
});
|
|
26018
|
-
|
|
26019
25988
|
screen.render();
|
|
26020
25989
|
return;
|
|
26021
25990
|
}
|
|
26022
25991
|
|
|
26023
|
-
|
|
26024
25992
|
function savePrompt(lines) {
|
|
26025
25993
|
try { process.stdin.setRawMode(false); } catch {}
|
|
26026
25994
|
|
package/package.json
CHANGED
package/src/starlight.js
CHANGED
|
@@ -2,14 +2,14 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const os = require('os');
|
|
4
4
|
const { exec } = require('child_process');
|
|
5
|
-
const readline = require('readline');
|
|
6
5
|
const readlineSync = require('readline-sync');
|
|
7
6
|
const blessed = require('blessed');
|
|
7
|
+
|
|
8
8
|
const Lexer = require('./lexer');
|
|
9
9
|
const Parser = require('./parser');
|
|
10
10
|
const Evaluator = require('./evaluator');
|
|
11
11
|
|
|
12
|
-
const VERSION = '1.0.
|
|
12
|
+
const VERSION = '1.0.15';
|
|
13
13
|
|
|
14
14
|
const COLOR = {
|
|
15
15
|
reset: '\x1b[0m',
|
|
@@ -23,7 +23,6 @@ const COLOR = {
|
|
|
23
23
|
magenta: '\x1b[35m'
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
|
|
27
26
|
function waitAndExit(code = 0) {
|
|
28
27
|
try { process.stdin.setRawMode(true); } catch {}
|
|
29
28
|
console.error(COLOR.gray + '\nPress any key to exit...' + COLOR.reset);
|
|
@@ -36,21 +35,13 @@ function fatal(msg) {
|
|
|
36
35
|
waitAndExit(1);
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return line
|
|
42
|
-
// strings
|
|
38
|
+
function highlightCode(text) {
|
|
39
|
+
return text
|
|
43
40
|
.replace(/"(?:\\.|[^"])*"/g, m => COLOR.yellow + m + COLOR.reset)
|
|
44
|
-
// numbers
|
|
45
41
|
.replace(/\b\d+(\.\d+)?\b/g, m => COLOR.magenta + m + COLOR.reset)
|
|
46
|
-
|
|
47
|
-
.replace(
|
|
48
|
-
/\b(sldeploy|import|from|const|let|var|if|else|for|while|func|return|break|continue|define|ask)\b/g,
|
|
49
|
-
m => COLOR.blue + m + COLOR.reset
|
|
50
|
-
);
|
|
42
|
+
.replace(/\b(sldeploy|import|from|const|let|var|if|else|for|while|func|return|break|continue|define|ask)\b/g, m => COLOR.blue + m + COLOR.reset);
|
|
51
43
|
}
|
|
52
44
|
|
|
53
|
-
|
|
54
45
|
const args = process.argv.slice(2);
|
|
55
46
|
|
|
56
47
|
if (args.length === 0) {
|
|
@@ -86,9 +77,7 @@ if (args[0] === '--learn') {
|
|
|
86
77
|
process.exit(0);
|
|
87
78
|
}
|
|
88
79
|
|
|
89
|
-
|
|
90
80
|
if (args[0] === '--writedirectly') {
|
|
91
|
-
const blessed = require('blessed');
|
|
92
81
|
const tempFile = path.join(os.tmpdir(), `starlight-${Date.now()}.sl`);
|
|
93
82
|
|
|
94
83
|
const screen = blessed.screen({
|
|
@@ -137,19 +126,14 @@ if (args[0] === '--writedirectly') {
|
|
|
137
126
|
editor.focus();
|
|
138
127
|
screen.render();
|
|
139
128
|
|
|
140
|
-
function highlightCode(text) {
|
|
141
|
-
return text
|
|
142
|
-
.replace(/"(.*?)"/g, '{yellow-fg}"$1"{/}')
|
|
143
|
-
.replace(/\b\d+(\.\d+)?\b/g, '{magenta-fg}$&{/}')
|
|
144
|
-
.replace(/\b(sldeploy|import|from|const|let|var|if|else|for|while|func|return|break|continue|define|ask)\b/g, '{blue-fg}$1{/}');
|
|
145
|
-
}
|
|
146
|
-
|
|
147
129
|
screen.key(['C-q'], () => screen.destroy());
|
|
130
|
+
|
|
148
131
|
screen.key(['C-s'], () => {
|
|
149
132
|
fs.writeFileSync(tempFile, editor.getValue());
|
|
150
133
|
output.setContent(' Saved ');
|
|
151
134
|
screen.render();
|
|
152
135
|
});
|
|
136
|
+
|
|
153
137
|
screen.key(['C-r'], () => {
|
|
154
138
|
fs.writeFileSync(tempFile, editor.getValue());
|
|
155
139
|
output.setContent(' Running... ');
|
|
@@ -161,18 +145,10 @@ if (args[0] === '--writedirectly') {
|
|
|
161
145
|
});
|
|
162
146
|
});
|
|
163
147
|
|
|
164
|
-
editor.on('keypress', () => {
|
|
165
|
-
const cursor = editor.getCursor();
|
|
166
|
-
editor.setValue(highlightCode(editor.getValue()));
|
|
167
|
-
editor.move(cursor.y, cursor.x);
|
|
168
|
-
screen.render();
|
|
169
|
-
});
|
|
170
|
-
|
|
171
148
|
screen.render();
|
|
172
149
|
return;
|
|
173
150
|
}
|
|
174
151
|
|
|
175
|
-
|
|
176
152
|
function savePrompt(lines) {
|
|
177
153
|
try { process.stdin.setRawMode(false); } catch {}
|
|
178
154
|
|