cc4-embedded-system 3.1.8 → 3.1.9
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/README.md +2 -2
- package/dist/makefsdata.js +2 -0
- package/dist/public/index.html +16 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
- This version based on [html-minifier-next](https://github.com/j9t/html-minifier-next) and rewrite [lwIP makefsdata](https://github.com/m-labs/lwip/tree/master/src/apps/httpd/makefsdata), run on localhost, default port: ```3000```.
|
|
3
3
|
- This tool is deployed on [npm package](https://www.npmjs.com/package/cc4-embedded-system).
|
|
4
4
|
|
|
5
|
-

|
|
6
6
|
|
|
7
7
|
## Structure
|
|
8
8
|
```text
|
|
@@ -14,7 +14,7 @@ CC4EmbeddedSystem/
|
|
|
14
14
|
├── public/
|
|
15
15
|
│ └── index.html // Web GUI dashboard
|
|
16
16
|
├── Sereenshot/
|
|
17
|
-
│ └── v3.1.
|
|
17
|
+
│ └── v3.1.9.png // Demo image
|
|
18
18
|
├── node_modules/ // Required submodules during development
|
|
19
19
|
├── dist/ // Compiled JavaScript output (Auto-generated)
|
|
20
20
|
├── package.json // Project configuration & dependencies
|
package/dist/makefsdata.js
CHANGED
|
@@ -322,10 +322,12 @@ export async function runMakeFsData(opts) {
|
|
|
322
322
|
if (rootNode) {
|
|
323
323
|
cOutput += `#define FS_ROOT file_${rootNode.varName}\n#define FS_NUMFILES ${orderedFileEntries.length + (hasRealRedirhome ? 0 : 1)}\n`;
|
|
324
324
|
fs.writeFileSync(opts.outputFile, cOutput);
|
|
325
|
+
const convertedSize = fs.statSync(opts.outputFile).size;
|
|
325
326
|
console.log(`\n✨ Success! Output written to: ${opts.outputFile}`);
|
|
326
327
|
return {
|
|
327
328
|
originalSize: totalOriginalSize,
|
|
328
329
|
compressedSize: totalCompressedSize,
|
|
330
|
+
convertedSize: convertedSize,
|
|
329
331
|
filesCount: orderedFileEntries.length
|
|
330
332
|
};
|
|
331
333
|
}
|
package/dist/public/index.html
CHANGED
|
@@ -94,12 +94,13 @@
|
|
|
94
94
|
</div>
|
|
95
95
|
</details>
|
|
96
96
|
|
|
97
|
-
<div id="statsPanel" class="stats-panel">
|
|
98
|
-
<div class="stats-title">📊 Compression Analysis</div>
|
|
99
|
-
<div class="stats-info">
|
|
100
|
-
<span>Compressed: <span id="compSize" style="color: #9cdcfe;">0</span> KB</span>
|
|
101
|
-
<span>
|
|
102
|
-
|
|
97
|
+
<div id="statsPanel" class="stats-panel">
|
|
98
|
+
<div class="stats-title">📊 Compression Analysis</div>
|
|
99
|
+
<div class="stats-info">
|
|
100
|
+
<span>Compressed: <span id="compSize" style="color: #9cdcfe;">0</span> KB</span>
|
|
101
|
+
<span>Converted: <span id="convSize" style="color: #dcdcaa;">0</span> KB</span>
|
|
102
|
+
<span>Original: <span id="origSize" style="color: #ce9178;">0</span> KB</span>
|
|
103
|
+
</div>
|
|
103
104
|
<div class="bar-container">
|
|
104
105
|
<div id="barFill" class="bar-fill"></div>
|
|
105
106
|
<div id="barText" class="bar-text">0% Saved</div>
|
|
@@ -261,18 +262,20 @@
|
|
|
261
262
|
const panel = document.getElementById('statsPanel');
|
|
262
263
|
panel.style.display = 'block';
|
|
263
264
|
|
|
264
|
-
const { originalSize, compressedSize } = result.stats;
|
|
265
|
-
const origKB = (originalSize / 1024).toFixed(2);
|
|
266
|
-
const compKB = (compressedSize / 1024).toFixed(2);
|
|
265
|
+
const { originalSize, compressedSize, convertedSize } = result.stats;
|
|
266
|
+
const origKB = (originalSize / 1024).toFixed(2);
|
|
267
|
+
const compKB = (compressedSize / 1024).toFixed(2);
|
|
268
|
+
const convKB = (convertedSize / 1024).toFixed(2);
|
|
267
269
|
|
|
268
270
|
// ratio: the saved percentage
|
|
269
271
|
const ratio = originalSize > 0 ? (((originalSize - compressedSize) / originalSize) * 100).toFixed(1) : 0;
|
|
270
272
|
// compressedRatio: the remainings percentage
|
|
271
273
|
const compressedRatio = (100 - ratio).toFixed(1);
|
|
272
274
|
|
|
273
|
-
document.getElementById('origSize').innerText = origKB;
|
|
274
|
-
document.getElementById('compSize').innerText = compKB;
|
|
275
|
-
document.getElementById('
|
|
275
|
+
document.getElementById('origSize').innerText = origKB;
|
|
276
|
+
document.getElementById('compSize').innerText = compKB;
|
|
277
|
+
document.getElementById('convSize').innerText = convKB;
|
|
278
|
+
document.getElementById('barText').innerText = `${ratio}% Size Reduced`;
|
|
276
279
|
|
|
277
280
|
// actual used percentage
|
|
278
281
|
setTimeout(() => {
|
|
@@ -314,4 +317,4 @@
|
|
|
314
317
|
</div>
|
|
315
318
|
|
|
316
319
|
</body>
|
|
317
|
-
</html>
|
|
320
|
+
</html>
|