esp32tool 1.1.9 → 1.3.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/.nojekyll +0 -0
- package/README.md +100 -6
- package/apple-touch-icon.png +0 -0
- package/build-electron-cli.cjs +177 -0
- package/build-single-binary.cjs +295 -0
- package/css/light.css +11 -0
- package/css/style.css +261 -41
- package/dist/cli.d.ts +17 -0
- package/dist/cli.js +458 -0
- package/dist/console.d.ts +15 -0
- package/dist/console.js +237 -0
- package/dist/const.d.ts +99 -0
- package/dist/const.js +129 -8
- package/dist/esp_loader.d.ts +244 -22
- package/dist/esp_loader.js +1960 -251
- package/dist/index.d.ts +2 -1
- package/dist/index.js +37 -4
- package/dist/node-usb-adapter.d.ts +47 -0
- package/dist/node-usb-adapter.js +725 -0
- package/dist/stubs/index.d.ts +1 -2
- package/dist/stubs/index.js +4 -0
- package/dist/util/console-color.d.ts +19 -0
- package/dist/util/console-color.js +272 -0
- package/dist/util/line-break-transformer.d.ts +5 -0
- package/dist/util/line-break-transformer.js +17 -0
- package/dist/web/index.js +1 -1
- package/electron/cli-main.cjs +74 -0
- package/electron/main.cjs +338 -0
- package/electron/main.js +7 -2
- package/favicon.ico +0 -0
- package/fix-cli-imports.cjs +127 -0
- package/generate-icons.sh +89 -0
- package/icons/icon-128.png +0 -0
- package/icons/icon-144.png +0 -0
- package/icons/icon-152.png +0 -0
- package/icons/icon-192.png +0 -0
- package/icons/icon-384.png +0 -0
- package/icons/icon-512.png +0 -0
- package/icons/icon-72.png +0 -0
- package/icons/icon-96.png +0 -0
- package/index.html +143 -73
- package/install-android.html +411 -0
- package/js/console.js +269 -0
- package/js/modules/esptool.js +1 -1
- package/js/script.js +750 -175
- package/js/util/console-color.js +282 -0
- package/js/util/line-break-transformer.js +19 -0
- package/js/webusb-serial.js +1017 -0
- package/license.md +1 -1
- package/manifest.json +89 -0
- package/package.cli.json +29 -0
- package/package.json +35 -24
- package/screenshots/desktop.png +0 -0
- package/screenshots/mobile.png +0 -0
- package/src/cli.ts +618 -0
- package/src/console.ts +278 -0
- package/src/const.ts +165 -8
- package/src/esp_loader.ts +2354 -302
- package/src/index.ts +69 -3
- package/src/node-usb-adapter.ts +924 -0
- package/src/stubs/index.ts +4 -1
- package/src/util/console-color.ts +290 -0
- package/src/util/line-break-transformer.ts +20 -0
- package/sw.js +155 -0
package/dist/stubs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChipFamily } from "../const";
|
|
2
|
-
interface Stub {
|
|
2
|
+
export interface Stub {
|
|
3
3
|
text: number[];
|
|
4
4
|
data: number[];
|
|
5
5
|
text_start: number;
|
|
@@ -7,4 +7,3 @@ interface Stub {
|
|
|
7
7
|
data_start: number;
|
|
8
8
|
}
|
|
9
9
|
export declare const getStubCode: (chipFamily: ChipFamily, chipRevision?: number | null) => Promise<Stub | null>;
|
|
10
|
-
export {};
|
package/dist/stubs/index.js
CHANGED
|
@@ -47,6 +47,10 @@ export const getStubCode = async (chipFamily, chipRevision) => {
|
|
|
47
47
|
stubcode = await import("./esp32p4.json");
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
else {
|
|
51
|
+
// Unknown chip family - no stub available
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
50
54
|
// Base64 decode the text and data
|
|
51
55
|
return {
|
|
52
56
|
...stubcode,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface ConsoleState {
|
|
2
|
+
bold: boolean;
|
|
3
|
+
italic: boolean;
|
|
4
|
+
underline: boolean;
|
|
5
|
+
strikethrough: boolean;
|
|
6
|
+
foregroundColor: string | null;
|
|
7
|
+
backgroundColor: string | null;
|
|
8
|
+
carriageReturn: boolean;
|
|
9
|
+
secret: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare class ColoredConsole {
|
|
12
|
+
targetElement: HTMLElement;
|
|
13
|
+
state: ConsoleState;
|
|
14
|
+
constructor(targetElement: HTMLElement);
|
|
15
|
+
logs(): string;
|
|
16
|
+
addLine(line: string): void;
|
|
17
|
+
}
|
|
18
|
+
export declare const coloredConsoleStyles = "\n .log {\n flex: 1;\n background-color: #1c1c1c;\n font-family: \"SFMono-Regular\", Consolas, \"Liberation Mono\", Menlo, Courier,\n monospace;\n font-size: 12px;\n padding: 16px;\n overflow: auto;\n line-height: 1.45;\n border-radius: 3px;\n white-space: pre-wrap;\n overflow-wrap: break-word;\n color: #ddd;\n }\n\n .log-bold {\n font-weight: bold;\n }\n .log-italic {\n font-style: italic;\n }\n .log-underline {\n text-decoration: underline;\n }\n .log-strikethrough {\n text-decoration: line-through;\n }\n .log-underline.log-strikethrough {\n text-decoration: underline line-through;\n }\n .log-secret {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n .log-secret-redacted {\n opacity: 0;\n width: 1px;\n font-size: 1px;\n }\n .log-fg-black {\n color: rgb(128, 128, 128);\n }\n .log-fg-red {\n color: rgb(255, 0, 0);\n }\n .log-fg-green {\n color: rgb(0, 255, 0);\n }\n .log-fg-yellow {\n color: rgb(255, 255, 0);\n }\n .log-fg-blue {\n color: rgb(0, 0, 255);\n }\n .log-fg-magenta {\n color: rgb(255, 0, 255);\n }\n .log-fg-cyan {\n color: rgb(0, 255, 255);\n }\n .log-fg-white {\n color: rgb(187, 187, 187);\n }\n .log-bg-black {\n background-color: rgb(0, 0, 0);\n }\n .log-bg-red {\n background-color: rgb(255, 0, 0);\n }\n .log-bg-green {\n background-color: rgb(0, 255, 0);\n }\n .log-bg-yellow {\n background-color: rgb(255, 255, 0);\n }\n .log-bg-blue {\n background-color: rgb(0, 0, 255);\n }\n .log-bg-magenta {\n background-color: rgb(255, 0, 255);\n }\n .log-bg-cyan {\n background-color: rgb(0, 255, 255);\n }\n .log-bg-white {\n background-color: rgb(255, 255, 255);\n }\n";
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
export class ColoredConsole {
|
|
2
|
+
constructor(targetElement) {
|
|
3
|
+
this.targetElement = targetElement;
|
|
4
|
+
this.state = {
|
|
5
|
+
bold: false,
|
|
6
|
+
italic: false,
|
|
7
|
+
underline: false,
|
|
8
|
+
strikethrough: false,
|
|
9
|
+
foregroundColor: null,
|
|
10
|
+
backgroundColor: null,
|
|
11
|
+
carriageReturn: false,
|
|
12
|
+
secret: false,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
logs() {
|
|
16
|
+
return this.targetElement.innerText;
|
|
17
|
+
}
|
|
18
|
+
addLine(line) {
|
|
19
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: ANSI escape sequences
|
|
20
|
+
const re = /(?:\x1B|\\x1B)(?:\[(.*?)[@-~]|\].*?(?:\x07|\x1B\\))/g;
|
|
21
|
+
let i = 0;
|
|
22
|
+
if (this.state.carriageReturn) {
|
|
23
|
+
if (line !== "\n") {
|
|
24
|
+
// don't remove if \r\n
|
|
25
|
+
if (this.targetElement.lastChild) {
|
|
26
|
+
this.targetElement.removeChild(this.targetElement.lastChild);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
this.state.carriageReturn = false;
|
|
30
|
+
}
|
|
31
|
+
const hasBareCR = line.endsWith("\r") && !line.endsWith("\r\n");
|
|
32
|
+
if (hasBareCR) {
|
|
33
|
+
this.state.carriageReturn = true;
|
|
34
|
+
}
|
|
35
|
+
const lineSpan = document.createElement("span");
|
|
36
|
+
lineSpan.classList.add("line");
|
|
37
|
+
this.targetElement.appendChild(lineSpan);
|
|
38
|
+
const addSpan = (content) => {
|
|
39
|
+
if (content === "")
|
|
40
|
+
return;
|
|
41
|
+
const span = document.createElement("span");
|
|
42
|
+
if (this.state.bold)
|
|
43
|
+
span.classList.add("log-bold");
|
|
44
|
+
if (this.state.italic)
|
|
45
|
+
span.classList.add("log-italic");
|
|
46
|
+
if (this.state.underline)
|
|
47
|
+
span.classList.add("log-underline");
|
|
48
|
+
if (this.state.strikethrough)
|
|
49
|
+
span.classList.add("log-strikethrough");
|
|
50
|
+
if (this.state.secret)
|
|
51
|
+
span.classList.add("log-secret");
|
|
52
|
+
if (this.state.foregroundColor !== null)
|
|
53
|
+
span.classList.add(`log-fg-${this.state.foregroundColor}`);
|
|
54
|
+
if (this.state.backgroundColor !== null)
|
|
55
|
+
span.classList.add(`log-bg-${this.state.backgroundColor}`);
|
|
56
|
+
span.appendChild(document.createTextNode(content));
|
|
57
|
+
lineSpan.appendChild(span);
|
|
58
|
+
if (this.state.secret) {
|
|
59
|
+
const redacted = document.createElement("span");
|
|
60
|
+
redacted.classList.add("log-secret-redacted");
|
|
61
|
+
redacted.appendChild(document.createTextNode("[redacted]"));
|
|
62
|
+
lineSpan.appendChild(redacted);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
while (true) {
|
|
66
|
+
const match = re.exec(line);
|
|
67
|
+
if (match === null)
|
|
68
|
+
break;
|
|
69
|
+
const j = match.index;
|
|
70
|
+
addSpan(line.substring(i, j));
|
|
71
|
+
i = j + match[0].length;
|
|
72
|
+
if (match[1] === undefined)
|
|
73
|
+
continue;
|
|
74
|
+
for (const colorCode of match[1].split(";")) {
|
|
75
|
+
switch (parseInt(colorCode)) {
|
|
76
|
+
case 0:
|
|
77
|
+
// reset
|
|
78
|
+
this.state.bold = false;
|
|
79
|
+
this.state.italic = false;
|
|
80
|
+
this.state.underline = false;
|
|
81
|
+
this.state.strikethrough = false;
|
|
82
|
+
this.state.foregroundColor = null;
|
|
83
|
+
this.state.backgroundColor = null;
|
|
84
|
+
this.state.secret = false;
|
|
85
|
+
break;
|
|
86
|
+
case 1:
|
|
87
|
+
this.state.bold = true;
|
|
88
|
+
break;
|
|
89
|
+
case 3:
|
|
90
|
+
this.state.italic = true;
|
|
91
|
+
break;
|
|
92
|
+
case 4:
|
|
93
|
+
this.state.underline = true;
|
|
94
|
+
break;
|
|
95
|
+
case 5:
|
|
96
|
+
this.state.secret = true;
|
|
97
|
+
break;
|
|
98
|
+
case 6:
|
|
99
|
+
this.state.secret = false;
|
|
100
|
+
break;
|
|
101
|
+
case 9:
|
|
102
|
+
this.state.strikethrough = true;
|
|
103
|
+
break;
|
|
104
|
+
case 22:
|
|
105
|
+
this.state.bold = false;
|
|
106
|
+
break;
|
|
107
|
+
case 23:
|
|
108
|
+
this.state.italic = false;
|
|
109
|
+
break;
|
|
110
|
+
case 24:
|
|
111
|
+
this.state.underline = false;
|
|
112
|
+
break;
|
|
113
|
+
case 29:
|
|
114
|
+
this.state.strikethrough = false;
|
|
115
|
+
break;
|
|
116
|
+
case 30:
|
|
117
|
+
this.state.foregroundColor = "black";
|
|
118
|
+
break;
|
|
119
|
+
case 31:
|
|
120
|
+
this.state.foregroundColor = "red";
|
|
121
|
+
break;
|
|
122
|
+
case 32:
|
|
123
|
+
this.state.foregroundColor = "green";
|
|
124
|
+
break;
|
|
125
|
+
case 33:
|
|
126
|
+
this.state.foregroundColor = "yellow";
|
|
127
|
+
break;
|
|
128
|
+
case 34:
|
|
129
|
+
this.state.foregroundColor = "blue";
|
|
130
|
+
break;
|
|
131
|
+
case 35:
|
|
132
|
+
this.state.foregroundColor = "magenta";
|
|
133
|
+
break;
|
|
134
|
+
case 36:
|
|
135
|
+
this.state.foregroundColor = "cyan";
|
|
136
|
+
break;
|
|
137
|
+
case 37:
|
|
138
|
+
this.state.foregroundColor = "white";
|
|
139
|
+
break;
|
|
140
|
+
case 39:
|
|
141
|
+
this.state.foregroundColor = null;
|
|
142
|
+
break;
|
|
143
|
+
case 41:
|
|
144
|
+
this.state.backgroundColor = "red";
|
|
145
|
+
break;
|
|
146
|
+
case 42:
|
|
147
|
+
this.state.backgroundColor = "green";
|
|
148
|
+
break;
|
|
149
|
+
case 43:
|
|
150
|
+
this.state.backgroundColor = "yellow";
|
|
151
|
+
break;
|
|
152
|
+
case 44:
|
|
153
|
+
this.state.backgroundColor = "blue";
|
|
154
|
+
break;
|
|
155
|
+
case 45:
|
|
156
|
+
this.state.backgroundColor = "magenta";
|
|
157
|
+
break;
|
|
158
|
+
case 46:
|
|
159
|
+
this.state.backgroundColor = "cyan";
|
|
160
|
+
break;
|
|
161
|
+
case 47:
|
|
162
|
+
this.state.backgroundColor = "white";
|
|
163
|
+
break;
|
|
164
|
+
case 40:
|
|
165
|
+
this.state.backgroundColor = "black";
|
|
166
|
+
break;
|
|
167
|
+
case 49:
|
|
168
|
+
this.state.backgroundColor = null;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const atBottom = this.targetElement.scrollTop >
|
|
174
|
+
this.targetElement.scrollHeight - this.targetElement.offsetHeight - 50;
|
|
175
|
+
addSpan(line.substring(i));
|
|
176
|
+
// Keep scroll at bottom
|
|
177
|
+
if (atBottom) {
|
|
178
|
+
this.targetElement.scrollTop = this.targetElement.scrollHeight;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
export const coloredConsoleStyles = `
|
|
183
|
+
.log {
|
|
184
|
+
flex: 1;
|
|
185
|
+
background-color: #1c1c1c;
|
|
186
|
+
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,
|
|
187
|
+
monospace;
|
|
188
|
+
font-size: 12px;
|
|
189
|
+
padding: 16px;
|
|
190
|
+
overflow: auto;
|
|
191
|
+
line-height: 1.45;
|
|
192
|
+
border-radius: 3px;
|
|
193
|
+
white-space: pre-wrap;
|
|
194
|
+
overflow-wrap: break-word;
|
|
195
|
+
color: #ddd;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.log-bold {
|
|
199
|
+
font-weight: bold;
|
|
200
|
+
}
|
|
201
|
+
.log-italic {
|
|
202
|
+
font-style: italic;
|
|
203
|
+
}
|
|
204
|
+
.log-underline {
|
|
205
|
+
text-decoration: underline;
|
|
206
|
+
}
|
|
207
|
+
.log-strikethrough {
|
|
208
|
+
text-decoration: line-through;
|
|
209
|
+
}
|
|
210
|
+
.log-underline.log-strikethrough {
|
|
211
|
+
text-decoration: underline line-through;
|
|
212
|
+
}
|
|
213
|
+
.log-secret {
|
|
214
|
+
-webkit-user-select: none;
|
|
215
|
+
-moz-user-select: none;
|
|
216
|
+
-ms-user-select: none;
|
|
217
|
+
user-select: none;
|
|
218
|
+
}
|
|
219
|
+
.log-secret-redacted {
|
|
220
|
+
opacity: 0;
|
|
221
|
+
width: 1px;
|
|
222
|
+
font-size: 1px;
|
|
223
|
+
}
|
|
224
|
+
.log-fg-black {
|
|
225
|
+
color: rgb(128, 128, 128);
|
|
226
|
+
}
|
|
227
|
+
.log-fg-red {
|
|
228
|
+
color: rgb(255, 0, 0);
|
|
229
|
+
}
|
|
230
|
+
.log-fg-green {
|
|
231
|
+
color: rgb(0, 255, 0);
|
|
232
|
+
}
|
|
233
|
+
.log-fg-yellow {
|
|
234
|
+
color: rgb(255, 255, 0);
|
|
235
|
+
}
|
|
236
|
+
.log-fg-blue {
|
|
237
|
+
color: rgb(0, 0, 255);
|
|
238
|
+
}
|
|
239
|
+
.log-fg-magenta {
|
|
240
|
+
color: rgb(255, 0, 255);
|
|
241
|
+
}
|
|
242
|
+
.log-fg-cyan {
|
|
243
|
+
color: rgb(0, 255, 255);
|
|
244
|
+
}
|
|
245
|
+
.log-fg-white {
|
|
246
|
+
color: rgb(187, 187, 187);
|
|
247
|
+
}
|
|
248
|
+
.log-bg-black {
|
|
249
|
+
background-color: rgb(0, 0, 0);
|
|
250
|
+
}
|
|
251
|
+
.log-bg-red {
|
|
252
|
+
background-color: rgb(255, 0, 0);
|
|
253
|
+
}
|
|
254
|
+
.log-bg-green {
|
|
255
|
+
background-color: rgb(0, 255, 0);
|
|
256
|
+
}
|
|
257
|
+
.log-bg-yellow {
|
|
258
|
+
background-color: rgb(255, 255, 0);
|
|
259
|
+
}
|
|
260
|
+
.log-bg-blue {
|
|
261
|
+
background-color: rgb(0, 0, 255);
|
|
262
|
+
}
|
|
263
|
+
.log-bg-magenta {
|
|
264
|
+
background-color: rgb(255, 0, 255);
|
|
265
|
+
}
|
|
266
|
+
.log-bg-cyan {
|
|
267
|
+
background-color: rgb(0, 255, 255);
|
|
268
|
+
}
|
|
269
|
+
.log-bg-white {
|
|
270
|
+
background-color: rgb(255, 255, 255);
|
|
271
|
+
}
|
|
272
|
+
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class LineBreakTransformer {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.chunks = "";
|
|
4
|
+
}
|
|
5
|
+
transform(chunk, controller) {
|
|
6
|
+
// Append new chunks to existing chunks.
|
|
7
|
+
this.chunks += chunk;
|
|
8
|
+
// For each line breaks in chunks, send the parsed lines out.
|
|
9
|
+
const lines = this.chunks.split("\r\n");
|
|
10
|
+
this.chunks = lines.pop();
|
|
11
|
+
lines.forEach((line) => controller.enqueue(line + "\r\n"));
|
|
12
|
+
}
|
|
13
|
+
flush(controller) {
|
|
14
|
+
// When the stream is closed, flush any remaining chunks out.
|
|
15
|
+
controller.enqueue(this.chunks);
|
|
16
|
+
}
|
|
17
|
+
}
|