esp32tool 1.1.9 → 1.2.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 +225 -35
- package/dist/cli.d.ts +17 -0
- package/dist/cli.js +458 -0
- package/dist/esp_loader.d.ts +126 -20
- package/dist/esp_loader.js +1190 -230
- 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/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 +94 -64
- package/install-android.html +411 -0
- package/js/modules/esptool.js +1 -1
- package/js/script.js +165 -160
- 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 +31 -21
- package/screenshots/desktop.png +0 -0
- package/screenshots/mobile.png +0 -0
- package/src/cli.ts +618 -0
- package/src/esp_loader.ts +1392 -261
- package/src/index.ts +69 -3
- package/src/node-usb-adapter.ts +924 -0
- package/src/stubs/index.ts +4 -1
- package/sw.js +155 -0
package/src/stubs/index.ts
CHANGED
|
@@ -25,7 +25,7 @@ interface LoadedStub {
|
|
|
25
25
|
data_start: number;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
interface Stub {
|
|
28
|
+
export interface Stub {
|
|
29
29
|
text: number[];
|
|
30
30
|
data: number[];
|
|
31
31
|
text_start: number;
|
|
@@ -75,6 +75,9 @@ export const getStubCode = async (
|
|
|
75
75
|
} else {
|
|
76
76
|
stubcode = await import("./esp32p4.json");
|
|
77
77
|
}
|
|
78
|
+
} else {
|
|
79
|
+
// Unknown chip family - no stub available
|
|
80
|
+
return null;
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
// Base64 decode the text and data
|
package/sw.js
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// Service Worker for ESP32Tool PWA
|
|
2
|
+
const CACHE_NAME = 'esp32tool-v1.2.0';
|
|
3
|
+
const RUNTIME_CACHE = 'esp32tool-runtime';
|
|
4
|
+
|
|
5
|
+
// Core files to cache on install (relative paths work for any deployment path)
|
|
6
|
+
// This ensures the app works completely offline after installation
|
|
7
|
+
const CORE_ASSETS = [
|
|
8
|
+
// App shell
|
|
9
|
+
'./',
|
|
10
|
+
'./index.html',
|
|
11
|
+
'./install-android.html',
|
|
12
|
+
|
|
13
|
+
// Stylesheets
|
|
14
|
+
'./css/style.css',
|
|
15
|
+
'./css/light.css',
|
|
16
|
+
'./css/dark.css',
|
|
17
|
+
|
|
18
|
+
// JavaScript
|
|
19
|
+
'./js/script.js',
|
|
20
|
+
'./js/utilities.js',
|
|
21
|
+
'./js/webusb-serial.js',
|
|
22
|
+
'./js/modules/esptool.js',
|
|
23
|
+
|
|
24
|
+
// PWA manifest
|
|
25
|
+
'./manifest.json',
|
|
26
|
+
|
|
27
|
+
// Icons (all sizes referenced in manifest)
|
|
28
|
+
'./icons/icon-72.png',
|
|
29
|
+
'./icons/icon-96.png',
|
|
30
|
+
'./icons/icon-128.png',
|
|
31
|
+
'./icons/icon-144.png',
|
|
32
|
+
'./icons/icon-152.png',
|
|
33
|
+
'./icons/icon-192.png',
|
|
34
|
+
'./icons/icon-384.png',
|
|
35
|
+
'./icons/icon-512.png',
|
|
36
|
+
'./apple-touch-icon.png',
|
|
37
|
+
'./favicon.ico',
|
|
38
|
+
|
|
39
|
+
// WASM modules (required for filesystem operations)
|
|
40
|
+
'./src/wasm/littlefs/index.js',
|
|
41
|
+
'./src/wasm/littlefs/littlefs.js',
|
|
42
|
+
'./src/wasm/littlefs/littlefs.wasm',
|
|
43
|
+
'./src/wasm/fatfs/index.js',
|
|
44
|
+
'./src/wasm/fatfs/fatfs.wasm'
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
// Install event - cache core assets
|
|
48
|
+
self.addEventListener('install', (event) => {
|
|
49
|
+
console.log('[SW] Installing service worker...');
|
|
50
|
+
event.waitUntil(
|
|
51
|
+
caches.open(CACHE_NAME)
|
|
52
|
+
.then((cache) => {
|
|
53
|
+
console.log('[SW] Caching core assets');
|
|
54
|
+
return cache.addAll(CORE_ASSETS);
|
|
55
|
+
})
|
|
56
|
+
.then(() => {
|
|
57
|
+
console.log('[SW] Skipping waiting - activating immediately');
|
|
58
|
+
return self.skipWaiting();
|
|
59
|
+
})
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Activate event - clean up old caches
|
|
64
|
+
self.addEventListener('activate', (event) => {
|
|
65
|
+
console.log('[SW] Activating service worker...');
|
|
66
|
+
event.waitUntil(
|
|
67
|
+
caches.keys().then((cacheNames) => {
|
|
68
|
+
return Promise.all(
|
|
69
|
+
cacheNames
|
|
70
|
+
.filter((name) => name !== CACHE_NAME && name !== RUNTIME_CACHE)
|
|
71
|
+
.map((name) => {
|
|
72
|
+
console.log('[SW] Deleting old cache:', name);
|
|
73
|
+
return caches.delete(name);
|
|
74
|
+
})
|
|
75
|
+
);
|
|
76
|
+
}).then(() => self.clients.claim())
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Fetch event - network first, fallback to cache
|
|
81
|
+
self.addEventListener('fetch', (event) => {
|
|
82
|
+
const { request } = event;
|
|
83
|
+
const url = new URL(request.url);
|
|
84
|
+
|
|
85
|
+
// Skip non-GET requests
|
|
86
|
+
if (request.method !== 'GET') {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Skip chrome-extension and other non-http(s) requests
|
|
91
|
+
if (!url.protocol.startsWith('http')) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Network first strategy for HTML and API calls
|
|
96
|
+
if (request.headers.get('accept')?.includes('text/html')) {
|
|
97
|
+
event.respondWith(
|
|
98
|
+
fetch(request)
|
|
99
|
+
.then((response) => {
|
|
100
|
+
// Only cache successful responses
|
|
101
|
+
if (response && response.ok) {
|
|
102
|
+
// Clone and cache the response
|
|
103
|
+
const responseClone = response.clone();
|
|
104
|
+
caches.open(RUNTIME_CACHE).then((cache) => {
|
|
105
|
+
cache.put(request, responseClone);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return response;
|
|
109
|
+
})
|
|
110
|
+
.catch(() => {
|
|
111
|
+
// Fallback to cache
|
|
112
|
+
return caches.match(request);
|
|
113
|
+
})
|
|
114
|
+
);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Cache first strategy for static assets
|
|
119
|
+
event.respondWith(
|
|
120
|
+
caches.match(request)
|
|
121
|
+
.then((cachedResponse) => {
|
|
122
|
+
if (cachedResponse) {
|
|
123
|
+
return cachedResponse;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return fetch(request).then((response) => {
|
|
127
|
+
// Don't cache non-successful responses
|
|
128
|
+
if (!response || response.status !== 200 || response.type === 'error') {
|
|
129
|
+
return response;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Clone and cache the response
|
|
133
|
+
const responseClone = response.clone();
|
|
134
|
+
caches.open(RUNTIME_CACHE).then((cache) => {
|
|
135
|
+
cache.put(request, responseClone);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// CRITICAL: Return the response after caching
|
|
139
|
+
return response;
|
|
140
|
+
}).catch(() => {
|
|
141
|
+
// Network failed and not in cache - return a basic error response
|
|
142
|
+
// or optionally return an offline fallback
|
|
143
|
+
console.warn('[SW] Network request failed for:', request.url);
|
|
144
|
+
return new Response('Network unavailable', { status: 503 });
|
|
145
|
+
});
|
|
146
|
+
})
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// Handle messages from clients
|
|
151
|
+
self.addEventListener('message', (event) => {
|
|
152
|
+
if (event.data && event.data.type === 'SKIP_WAITING') {
|
|
153
|
+
self.skipWaiting();
|
|
154
|
+
}
|
|
155
|
+
});
|