esp32tool 1.1.2 → 1.1.3
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/package.json +5 -3
- package/tools/forge-fuses-plugin.cjs +53 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "esp32tool",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Flash & Read ESP devices using WebSerial",
|
|
5
5
|
"main": "electron/main.js",
|
|
6
6
|
"repository": {
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
},
|
|
13
13
|
"author": "Johann Obermeier",
|
|
14
14
|
"license": "MIT",
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=22.12.0"
|
|
17
|
+
},
|
|
15
18
|
"scripts": {
|
|
16
19
|
"prebuild": "node -e \"const fs=require('fs'); fs.rmSync('dist',{recursive:true,force:true}); fs.rmSync('js/modules',{recursive:true,force:true}); fs.mkdirSync('js/modules',{recursive:true});\"",
|
|
17
20
|
"build": "npm run prebuild && tsc && rollup -c && node -e \"const fs=require('fs'); fs.readdirSync('dist/web').filter(f=>f.endsWith('.js')).forEach(f=>fs.copyFileSync('dist/web/'+f,'js/modules/'+f)); fs.renameSync('js/modules/index.js','js/modules/esptool.js');\"",
|
|
@@ -38,8 +41,7 @@
|
|
|
38
41
|
"@electron-forge/maker-squirrel": "^7.6.0",
|
|
39
42
|
"@electron-forge/maker-zip": "^7.6.0",
|
|
40
43
|
"@electron-forge/plugin-auto-unpack-natives": "^7.6.0",
|
|
41
|
-
"@electron
|
|
42
|
-
"@electron/fuses": "^1.8.0",
|
|
44
|
+
"@electron/fuses": "^2.0.0",
|
|
43
45
|
"@rollup/plugin-json": "^6.1.0",
|
|
44
46
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
45
47
|
"@rollup/plugin-terser": "^0.4.4",
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const path = require('node:path');
|
|
2
|
+
const { PluginBase, namedHookWithTaskFn } = require('@electron-forge/plugin-base');
|
|
3
|
+
|
|
4
|
+
function getElectronExecutablePath({ appName, basePath, platform }) {
|
|
5
|
+
if (['darwin', 'mas'].includes(platform)) {
|
|
6
|
+
return path.join(basePath, 'MacOS', appName);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const suffix = platform === 'win32' ? '.exe' : '';
|
|
10
|
+
return path.join(basePath, `${appName}${suffix}`);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
class FusesPlugin extends PluginBase {
|
|
14
|
+
constructor(fusesConfig) {
|
|
15
|
+
super(fusesConfig);
|
|
16
|
+
this.name = 'fuses';
|
|
17
|
+
this.fusesConfig = fusesConfig ?? {};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getHooks() {
|
|
21
|
+
return {
|
|
22
|
+
packageAfterCopy: namedHookWithTaskFn(
|
|
23
|
+
async (listrTask, resolvedForgeConfig, resourcesPath, electronVersion, platform, arch) => {
|
|
24
|
+
if (!Object.keys(this.fusesConfig).length) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const applePlatforms = ['darwin', 'mas'];
|
|
29
|
+
const pathToElectronExecutable = getElectronExecutablePath({
|
|
30
|
+
appName: applePlatforms.includes(platform) ? 'Electron' : 'electron',
|
|
31
|
+
basePath: path.resolve(resourcesPath, '../..'),
|
|
32
|
+
platform,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const osxSignConfig = resolvedForgeConfig.packagerConfig.osxSign;
|
|
36
|
+
const hasOSXSignConfig =
|
|
37
|
+
(typeof osxSignConfig === 'object' && Boolean(Object.keys(osxSignConfig).length)) ||
|
|
38
|
+
Boolean(osxSignConfig);
|
|
39
|
+
|
|
40
|
+
const { flipFuses } = await import('@electron/fuses');
|
|
41
|
+
await flipFuses(pathToElectronExecutable, {
|
|
42
|
+
resetAdHocDarwinSignature:
|
|
43
|
+
!hasOSXSignConfig && applePlatforms.includes(platform) && arch === 'arm64',
|
|
44
|
+
...this.fusesConfig,
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
'Flipping Fuses'
|
|
48
|
+
),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = { FusesPlugin };
|