cc4-embedded-system 3.0.0 → 3.0.2

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 CHANGED
@@ -1,7 +1,8 @@
1
1
  # CC4EmbeddedSystem V3
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```.
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
+ - This tool is deployed on [npm package](https://www.npmjs.com/package/cc4-embedded-system).
3
4
 
4
- ![](./Screenshot/v3.0.0.png)
5
+ ![](./Screenshot/v3.0.1.png)
5
6
 
6
7
  ## Structure
7
8
  ```text
@@ -11,9 +12,13 @@ CC4EmbeddedSystem/
11
12
  │ └── makefsdata.ts // Core C code generation & minification logic
12
13
  ├── public/
13
14
  │ └── index.html // Web GUI dashboard
15
+ ├── Sereenshot/
16
+ │ └── v3.0.1.png // Demo image
17
+ ├── node_modules/ // Required submodules during development
14
18
  ├── dist/ // Compiled JavaScript output (Auto-generated)
15
- ├── tsconfig.json // TypeScript configuration
16
- └── package.json // Project configuration & dependencies
19
+ ├── package.json // Project configuration & dependencies
20
+ ├── package-lock.json // Project configuration & dependencies
21
+ └── tsconfig.json // TypeScript configuration
17
22
  ```
18
23
 
19
24
  ## Commands
Binary file
package/dist/gui.js CHANGED
@@ -62,8 +62,8 @@ import express from 'express';
62
62
  import open from 'open';
63
63
  import path from 'node:path';
64
64
  import { fileURLToPath } from 'node:url';
65
- import fs from 'node:fs';
66
65
  import { runMakeFsData } from './makefsdata.js';
66
+ import { getPackageVersion } from './utils.js';
67
67
  const __filename = fileURLToPath(import.meta.url);
68
68
  const __dirname = path.dirname(__filename);
69
69
  const app = express();
@@ -78,16 +78,6 @@ if (portArgIndex !== -1 && process.argv[portArgIndex + 1]) {
78
78
  let server;
79
79
  app.use(express.json());
80
80
  app.use(express.static(path.join(__dirname, '../public')));
81
- // get current version
82
- const getPackageVersion = () => {
83
- try {
84
- const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
85
- return pkg.version || "0.0.0";
86
- }
87
- catch {
88
- return "3.0.0";
89
- }
90
- };
91
81
  app.get('/api/version', (_req, res) => {
92
82
  res.json({ version: getPackageVersion() });
93
83
  });
@@ -60,20 +60,12 @@
60
60
  import fs from 'node:fs';
61
61
  import path from 'node:path';
62
62
  import { minify } from 'html-minifier-next';
63
+ import { getPackageVersion } from './utils.js';
63
64
  // ----------------------------------------------------------------------
64
65
  // 1. Configs & Version Recovery
65
66
  // ----------------------------------------------------------------------
66
67
  const TCP_MSS = 1460;
67
68
  const LWIP_VERSION = "1.3.1"; // this makefsdata.ts is based on lwIP v1.3.1
68
- const getPackageVersion = () => {
69
- try {
70
- const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
71
- return pkg.version || "0.0.0";
72
- }
73
- catch {
74
- return "v3.0.0";
75
- }
76
- };
77
69
  // html-minifier-next options
78
70
  const COMPRESS_OPTS_DEFAULT = {
79
71
  collapseWhitespace: true,
package/dist/utils.js ADDED
@@ -0,0 +1,73 @@
1
+ /*
2
+ * ==============================================================================
3
+ * CC4EmbeddedSystem V3 (makefsdata)
4
+ * Copyright (c) 2026 LunaticGhoulPiano / Emile Su
5
+ * Licensed under the MIT License.
6
+ * ==============================================================================
7
+ *
8
+ * This software integrates concepts, logic, and minification processes derived
9
+ * from the following open-source projects. We deeply appreciate their work:
10
+ *
11
+ * ------------------------------------------------------------------------------
12
+ * 1. lwIP (Lightweight TCP/IP stack)
13
+ * Repository: https://github.com/m-labs/lwip
14
+ * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
15
+ * All rights reserved.
16
+ * * Redistribution and use in source and binary forms, with or without modification,
17
+ * are permitted provided that the following conditions are met:
18
+ * * 1. Redistributions of source code must retain the above copyright notice,
19
+ * this list of conditions and the following disclaimer.
20
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
21
+ * this list of conditions and the following disclaimer in the documentation
22
+ * and/or other materials provided with the distribution.
23
+ * 3. The name of the author may not be used to endorse or promote products
24
+ * derived from this software without specific prior written permission.
25
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
26
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
28
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
30
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
33
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
34
+ * OF SUCH DAMAGE.
35
+ *
36
+ * ------------------------------------------------------------------------------
37
+ * 2. html-minifier-next
38
+ * Repository: https://github.com/j9t/html-minifier-next
39
+ * Copyright (c) Jens Oliver Meiert (html-minifier-next)
40
+ * Copyright (c) Daniel Ruf (html-minifier-terser)
41
+ * Copyright (c) Juriy "kangax" Zaytsev (html-minifier)
42
+ * * Permission is hereby granted, free of charge, to any person obtaining a copy
43
+ * of this software and associated documentation files (the "Software"), to deal
44
+ * in the Software without restriction, including without limitation the rights
45
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46
+ * copies of the Software, and to permit persons to whom the Software is
47
+ * furnished to do so, subject to the following conditions:
48
+ * * The above copyright notice and this permission notice shall be included in
49
+ * all copies or substantial portions of the Software.
50
+ * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
51
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
52
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
53
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
54
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
55
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
56
+ * THE SOFTWARE.
57
+ * ==============================================================================
58
+ */
59
+ import fs from 'node:fs';
60
+ import path from 'node:path';
61
+ import { fileURLToPath } from 'node:url';
62
+ const __filename = fileURLToPath(import.meta.url);
63
+ const __dirname = path.dirname(__filename);
64
+ export const getPackageVersion = () => {
65
+ try {
66
+ const pkgPath = path.join(__dirname, '../package.json');
67
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
68
+ return pkg.version || "LTS";
69
+ }
70
+ catch (error) {
71
+ return "LTS";
72
+ }
73
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc4-embedded-system",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "A modern typescript version of makefsdata based on html-minifier-next and lwIP v1.3.1",
5
5
  "bin": {
6
6
  "cc4es": "./dist/gui.js"
@@ -34,4 +34,4 @@
34
34
  "tsx": "^4.21.0",
35
35
  "typescript": "^6.0.3"
36
36
  }
37
- }
37
+ }
package/src/gui.ts CHANGED
@@ -64,8 +64,8 @@ import express from 'express';
64
64
  import open from 'open';
65
65
  import path from 'node:path';
66
66
  import { fileURLToPath } from 'node:url';
67
- import fs from 'node:fs';
68
67
  import { runMakeFsData, MakeFsDataOptions } from './makefsdata.js';
68
+ import { getPackageVersion } from './utils.js';
69
69
 
70
70
  const __filename: string = fileURLToPath(import.meta.url);
71
71
  const __dirname: string = path.dirname(__filename);
@@ -84,17 +84,6 @@ let server: any;
84
84
  app.use(express.json());
85
85
  app.use(express.static(path.join(__dirname, '../public')));
86
86
 
87
- // get current version
88
- const getPackageVersion = (): string => {
89
- try {
90
- const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
91
- return pkg.version || "0.0.0";
92
- }
93
- catch {
94
- return "3.0.0";
95
- }
96
- };
97
-
98
87
  app.get('/api/version', (_req: express.Request, res: express.Response) => {
99
88
  res.json({ version: getPackageVersion() });
100
89
  });
package/src/makefsdata.ts CHANGED
@@ -61,6 +61,7 @@
61
61
  import fs from 'node:fs';
62
62
  import path from 'node:path';
63
63
  import { minify } from 'html-minifier-next';
64
+ import { getPackageVersion } from './utils.js';
64
65
 
65
66
  // ----------------------------------------------------------------------
66
67
  // 1. Configs & Version Recovery
@@ -68,16 +69,6 @@ import { minify } from 'html-minifier-next';
68
69
  const TCP_MSS: number = 1460;
69
70
  const LWIP_VERSION: string = "1.3.1"; // this makefsdata.ts is based on lwIP v1.3.1
70
71
 
71
- const getPackageVersion = (): string => {
72
- try {
73
- const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
74
- return pkg.version || "0.0.0";
75
- }
76
- catch {
77
- return "v3.0.0";
78
- }
79
- };
80
-
81
72
  // html-minifier-next options
82
73
  const COMPRESS_OPTS_DEFAULT = {
83
74
  collapseWhitespace: true,
package/src/utils.ts ADDED
@@ -0,0 +1,76 @@
1
+ /*
2
+ * ==============================================================================
3
+ * CC4EmbeddedSystem V3 (makefsdata)
4
+ * Copyright (c) 2026 LunaticGhoulPiano / Emile Su
5
+ * Licensed under the MIT License.
6
+ * ==============================================================================
7
+ *
8
+ * This software integrates concepts, logic, and minification processes derived
9
+ * from the following open-source projects. We deeply appreciate their work:
10
+ *
11
+ * ------------------------------------------------------------------------------
12
+ * 1. lwIP (Lightweight TCP/IP stack)
13
+ * Repository: https://github.com/m-labs/lwip
14
+ * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
15
+ * All rights reserved.
16
+ * * Redistribution and use in source and binary forms, with or without modification,
17
+ * are permitted provided that the following conditions are met:
18
+ * * 1. Redistributions of source code must retain the above copyright notice,
19
+ * this list of conditions and the following disclaimer.
20
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
21
+ * this list of conditions and the following disclaimer in the documentation
22
+ * and/or other materials provided with the distribution.
23
+ * 3. The name of the author may not be used to endorse or promote products
24
+ * derived from this software without specific prior written permission.
25
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
26
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
28
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
30
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
33
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
34
+ * OF SUCH DAMAGE.
35
+ *
36
+ * ------------------------------------------------------------------------------
37
+ * 2. html-minifier-next
38
+ * Repository: https://github.com/j9t/html-minifier-next
39
+ * Copyright (c) Jens Oliver Meiert (html-minifier-next)
40
+ * Copyright (c) Daniel Ruf (html-minifier-terser)
41
+ * Copyright (c) Juriy "kangax" Zaytsev (html-minifier)
42
+ * * Permission is hereby granted, free of charge, to any person obtaining a copy
43
+ * of this software and associated documentation files (the "Software"), to deal
44
+ * in the Software without restriction, including without limitation the rights
45
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46
+ * copies of the Software, and to permit persons to whom the Software is
47
+ * furnished to do so, subject to the following conditions:
48
+ * * The above copyright notice and this permission notice shall be included in
49
+ * all copies or substantial portions of the Software.
50
+ * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
51
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
52
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
53
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
54
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
55
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
56
+ * THE SOFTWARE.
57
+ * ==============================================================================
58
+ */
59
+
60
+ import fs from 'node:fs';
61
+ import path from 'node:path';
62
+ import { fileURLToPath } from 'node:url';
63
+
64
+ const __filename = fileURLToPath(import.meta.url);
65
+ const __dirname = path.dirname(__filename);
66
+
67
+ export const getPackageVersion = (): string => {
68
+ try {
69
+ const pkgPath = path.join(__dirname, '../package.json');
70
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
71
+ return pkg.version || "LTS";
72
+ }
73
+ catch (error) {
74
+ return "LTS";
75
+ }
76
+ };
Binary file