Skip to content

Commit 75d77d5

Browse files
committed
release: 1.9.2
1 parent 5928afb commit 75d77d5

File tree

8 files changed

+855
-670
lines changed

8 files changed

+855
-670
lines changed

CHANGELOG.md

Lines changed: 162 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,227 @@
1-
# Change log
1+
# Changelog
22

3-
## 1.9
3+
All notable changes to this project will be documented in this file.
44

5-
### 1.9.1
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
67

7-
- Chore: deps
8-
- Chore: require Node.js >=20
8+
## [1.9.2] - 2025-10-18
99

10-
### 1.9.0
10+
### Changed
1111

12-
- Feat: allow code generator for esp-idf
12+
- Improved CLAUDE.md with detailed architecture information, processing pipeline details, and template system documentation
13+
- Enhanced README.md with comprehensive updates:
14+
- Added Node.js >= 20 and npm >= 9 requirements
15+
- Added ESP-IDF native code usage example
16+
- Improved generated code examples with complete header structure
17+
- Enhanced engine descriptions with detailed use cases
18+
- Added PsychicHttpServer `max_uri_handlers` configuration note
19+
- Improved compression output examples with percentage ratios
20+
- Better Q&A explanations for PROGMEM usage and file size
21+
- Updated command line options table with clarifications
22+
- Fixed inaccuracies in MIME type package references
23+
- Reformatted CHANGELOG.md to follow Keep a Changelog standard with proper categorization and GitHub comparison links
1324

14-
## 1.8
25+
## [1.9.1] - 2024-09-13
1526

16-
### 1.8.1
27+
### Changed
1728

18-
- Fix: http header casing
29+
- Updated dependencies
30+
- **BREAKING**: Require Node.js >= 20 and npm >= 9
1931

20-
### 1.8.0
32+
## [1.9.0] - 2024-03-31
2133

22-
- Using the new and maintained ESPAsyncWebserver available at https://github.com/ESP32Async/ESPAsyncWebServer, that has some deprecations.
34+
### Added
2335

24-
## 1.7
36+
- Code generator support for native ESP-IDF web server (`-e espidf`)
37+
- New `src/cppCodeEspIdf.ts` module for ESP-IDF template generation
38+
- ESP-IDF demo project in `demo/esp32idf/`
2539

26-
### 1.7.1
40+
## [1.8.1] - 2023-12-XX
2741

28-
- Due to ESM problems, we revert to using the **mime-types** npm module.
42+
### Fixed
2943

30-
### 1.7.0
44+
- HTTP header casing issues
3145

32-
- Using the cachetime command line option, you can set whether the browser can cache pages. Together with the ETag switch, you can replace the default no-cache response with a max-age=xy response.
46+
## [1.8.0] - 2023-XX-XX
3347

34-
## 1.6
48+
### Changed
3549

36-
### 1.6.1
50+
- Updated to use the new and maintained ESPAsyncWebServer from https://github.com/ESP32Async/ESPAsyncWebServer
51+
- Adapted to ESPAsyncWebServer API deprecations
3752

38-
- Chore: force publish npm
53+
## [1.7.1] - 2023-XX-XX
3954

40-
### 1.6.0
55+
### Fixed
4156

42-
- Using mime npm package instead of mime-types: I prefer to use standard text/javascript. It better meets today's requirements.
57+
- Reverted to **mime-types** npm package due to ESM compatibility issues
4358

44-
## 1.5
59+
## [1.7.0] - 2023-XX-XX
4560

46-
### 1.5.2
61+
### Added
4762

48-
- chore: In the psychicHttp generated code, the minimum setting of server.config.max_uri_handlers (20 by default) is displayed as a comment so that all files can be served.
63+
- `--cachetime` command line option to control browser caching behavior
64+
- Ability to set `max-age` cache control header value (in seconds)
65+
- Works in conjunction with ETag to replace default `no-cache` response
4966

50-
### 1.5.1
67+
## [1.6.1] - 2023-XX-XX
5168

52-
- bugfix: It generated an error code if there was an @ sign in the file name. We tried to protect all possible characters: `!&()+./@{}~-`
69+
### Changed
5370

54-
### 1.5.0
71+
- Force publish to npm registry
5572

56-
- New engine type (-e psychic2) for PsychicHttp v2
73+
## [1.6.0] - 2023-XX-XX
5774

58-
- Run tests with github repos instead of packages
75+
### Changed
5976

60-
## 1.4
77+
- Switched to `mime-types` package for better MIME type handling
78+
- Updated MIME type for JavaScript files to standard `text/javascript` (was `application/javascript`)
6179

62-
### 1.4.1
80+
## [1.5.2] - 2023-XX-XX
6381

64-
- Implemented a new function to **identify and log files with identical content**.
82+
### Changed
6583

66-
- Added support for multiple linting tools to ensure higher code standards.
84+
- Added comment in PsychicHttpServer generated code suggesting minimum `server.config.max_uri_handlers` setting (default 20) to ensure all files can be served
6785

68-
### 1.4.0
86+
## [1.5.1] - 2023-XX-XX
6987

70-
- Breaking change: --no-gzip changed to --gzip
88+
### Fixed
7189

72-
- The etag and gzip compiler option: For Etag and Gzip switches, values ​​true|false|compiler can be used. In the case of a compiler value, both variants can be found in the .h file and you can decide at compile time which one should be used.
90+
- Fixed error when file names contain `@` character
91+
- Enhanced character protection for file name conversion to C++ identifiers: `!&()+./@{}~-`
7392

74-
- The created and version info: You can put the creation date and a version number in the .h file with the --created and --version options.
93+
## [1.5.0] - 2023-XX-XX
7594

76-
- 2x9 build and test system: We also run all possible parameter combinations (etag and gzip) for the Async and Psychic web servers.
95+
### Added
7796

78-
- Separated demo env
97+
- New engine type `-e psychic2` for PsychicHttpServer V2 support
98+
- PsychicHttpServer V2 template with updated API (response passed as parameter)
7999

80-
- Proper svelte demo app
100+
### Changed
81101

82-
- Create output directory: If output folder not exists, it will be automatically created
102+
- Test suite now uses GitHub repositories instead of npm packages
83103

84-
- Detect precompressed files: If a.b and a.b.gz exist together, the .gz file is not used (gz, br, brottli)
104+
## [1.4.1] - 2023-XX-XX
85105

86-
- Reduce .h file size: The size of the .h file has been reduced by 35-50%.
106+
### Added
87107

88-
- Skip gz under 1024: The gzip threshold increased to 1024 bytes.
108+
- Duplicate file detection using SHA256 hashing
109+
- Logging of files with identical content
110+
- Support for multiple linting tools (ESLint with TypeScript, Prettier, Unicorn plugins)
89111

90-
- Pipeline node version update
112+
## [1.4.0] - 2023-XX-XX
91113

92-
- Warning if not usable directive used
114+
### Added
93115

94-
- Colored console
116+
- Three-state option support for `--etag` and `--gzip` parameters: `true|false|compiler`
117+
- `compiler` mode generates both variants in .h file with C++ preprocessor directives
118+
- Allows runtime configuration via `SVELTEESP32_ENABLE_ETAG` and `SVELTEESP32_ENABLE_GZIP` defines
119+
- `--created` option to include creation timestamp in generated header
120+
- `--version` option to include version string in generated header
121+
- Comprehensive test system generating all parameter combinations (2×9 builds)
122+
- Automatic output directory creation if it doesn't exist
123+
- Pre-compressed file detection (skips `.gz`, `.br`, `.brottli` if original exists)
124+
- Colored console output for better readability
125+
- Warning messages when non-effective directives are used
95126

96-
## 1.3
127+
### Changed
97128

98-
### 1.3.1
129+
- **BREAKING**: Renamed `--no-gzip` to `--gzip` (inverted logic)
130+
- Increased gzip threshold from default to 1024 bytes minimum
131+
- Reduced generated .h file size by 35-50% through optimizations
132+
- Separated demo environment
133+
- Improved Svelte demo application
134+
- Updated pipeline Node.js version
99135

100-
- Filename directives are uppercased
136+
## [1.3.1] - 2023-XX-XX
101137

102-
- Filecount by extension
138+
### Changed
103139

104-
### 1.3.0
140+
- Filename C++ defines are now uppercased (e.g., `SVELTEESP32_FILE_INDEX_HTML`)
105141

106-
- C++ defines can be used
142+
### Added
107143

108-
- C++ defines group by filetypes: Should we be able to check if a given file name or number of files is correct? For this, we should find C++ defines in the generated code.
144+
- File count statistics grouped by extension (e.g., `SVELTEESP32_CSS_FILES`)
109145

110-
## 1.2
146+
## [1.3.0] - 2023-XX-XX
111147

112-
### 1.2.4
148+
### Added
113149

114-
- Deps update
150+
- C++ preprocessor defines for build-time validation:
151+
- `{PREFIX}_COUNT` - Total file count
152+
- `{PREFIX}_SIZE` - Total uncompressed size
153+
- `{PREFIX}_SIZE_GZIP` - Total gzip compressed size
154+
- `{PREFIX}_FILE_{FILENAME}` - Individual file markers
155+
- `{PREFIX}_{EXT}_FILES` - Count by file extension
156+
- Ability to use `#ifndef` and `#error` for compile-time checks
115157

116-
### 1.2.2
158+
## [1.2.4] - 2023-XX-XX
117159

118-
- Necessary C++ includes
160+
### Changed
119161

120-
### 1.2.1
162+
- Updated dependencies
121163

122-
- Windows paths
164+
## [1.2.2] - 2023-XX-XX
123165

124-
### 1.2.0
166+
### Added
125167

126-
- ESP8266/ESP8285 is also supported
168+
- Necessary C++ includes in generated headers
127169

128-
## 1.1
170+
## [1.2.1] - 2023-XX-XX
129171

130-
### 1.1.0
172+
### Fixed
131173

132-
- ETag available
174+
- Windows path handling
175+
176+
## [1.2.0] - 2023-XX-XX
177+
178+
### Added
179+
180+
- ESP8266/ESP8285 support
181+
- PROGMEM directive usage for ESPAsyncWebServer engine
182+
183+
## [1.1.0] - 2023-XX-XX
184+
185+
### Added
186+
187+
- ETag HTTP header support for cache validation
188+
- MD5 hash generation for ETag values
189+
- HTTP 304 Not Modified response handling
190+
- `--etag` command line option
191+
192+
## [1.0.0] - 2023-XX-XX
193+
194+
### Added
195+
196+
- Initial release
197+
- Support for PsychicHttpServer (ESP32)
198+
- Support for ESPAsyncWebServer (ESP32/ESP8266)
199+
- Automatic gzip compression for files >1024 bytes with >15% size reduction
200+
- Binary data embedding as const arrays
201+
- MIME type detection
202+
- Handlebars-based C++ code generation
203+
- CLI interface with `-s`, `-e`, `-o` options
204+
- `index.html` automatic default route handling
205+
206+
[1.9.2]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.9.1...v1.9.2
207+
[1.9.1]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.9.0...v1.9.1
208+
[1.9.0]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.8.1...v1.9.0
209+
[1.8.1]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.8.0...v1.8.1
210+
[1.8.0]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.7.1...v1.8.0
211+
[1.7.1]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.7.0...v1.7.1
212+
[1.7.0]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.6.1...v1.7.0
213+
[1.6.1]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.6.0...v1.6.1
214+
[1.6.0]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.5.2...v1.6.0
215+
[1.5.2]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.5.1...v1.5.2
216+
[1.5.1]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.5.0...v1.5.1
217+
[1.5.0]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.4.1...v1.5.0
218+
[1.4.1]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.4.0...v1.4.1
219+
[1.4.0]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.3.1...v1.4.0
220+
[1.3.1]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.3.0...v1.3.1
221+
[1.3.0]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.2.4...v1.3.0
222+
[1.2.4]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.2.2...v1.2.4
223+
[1.2.2]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.2.1...v1.2.2
224+
[1.2.1]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.2.0...v1.2.1
225+
[1.2.0]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.1.0...v1.2.0
226+
[1.1.0]: https://github.com/BCsabaEngine/svelteesp32/compare/v1.0.0...v1.1.0
227+
[1.0.0]: https://github.com/BCsabaEngine/svelteesp32/releases/tag/v1.0.0

CLAUDE.md

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ npx svelteesp32 -e async -s ./dist -o ./output.h --etag=true --gzip=true
6060

6161
# Generate header for ESP-IDF
6262
npx svelteesp32 -e espidf -s ./dist -o ./output.h --etag=true --gzip=true
63+
64+
# Test the CLI directly using tsx (for development)
65+
npx tsx src/index.ts -e psychic -s ./demo/svelte/dist -o ./output.h --etag=true --gzip=true
6366
```
6467

6568
## Architecture
@@ -75,11 +78,11 @@ npx svelteesp32 -e espidf -s ./dist -o ./output.h --etag=true --gzip=true
7578

7679
### Processing Pipeline
7780

78-
1. **File Collection**: Scans source directory for web assets
79-
2. **Content Analysis**: Determines MIME types and calculates MD5 hashes
80-
3. **Compression**: Applies gzip compression when beneficial (>1024 bytes, >15% reduction)
81-
4. **Code Generation**: Uses Handlebars templates to generate C++ header files
82-
5. **Output**: Writes optimized header with embedded binary data and web server handlers
81+
1. **File Collection** (`src/file.ts`): Scans source directory recursively using glob, skips pre-compressed files (.gz, .br) if originals exist, detects duplicate files via SHA256 hashing
82+
2. **Content Analysis** (`src/index.ts`): Determines MIME types using `mime-types` library, calculates MD5 hashes for ETag generation, groups files by extension for statistics
83+
3. **Compression** (`src/index.ts`): Applies gzip level 9 compression, uses compressed version only when size reduction >15% and original >1024 bytes
84+
4. **Code Generation** (`src/cppCode.ts`, `src/cppCodeEspIdf.ts`): Uses Handlebars templates with custom helpers (switch/case), generates engine-specific C++ code with conditional compilation support
85+
5. **Output**: Writes optimized header with embedded binary data arrays, route handlers, ETag strings, and C++ defines for validation
8386

8487
### Supported Engines
8588

@@ -113,15 +116,39 @@ npx svelteesp32 -e espidf -s ./dist -o ./output.h --etag=true --gzip=true
113116

114117
### Demo Projects
115118

116-
- **`demo/svelte/`**: Example Svelte application for testing
117-
- **`demo/esp32/`**: PlatformIO project demonstrating Arduino framework usage
118-
- **`demo/esp32idf/`**: ESP-IDF native project example
119+
- **`demo/svelte/`**: Example Svelte application with Vite, TailwindCSS, gallery images
120+
- **`demo/esp32/`**: PlatformIO Arduino framework project with WiFi credentials example
121+
- **`demo/esp32idf/`**: ESP-IDF native project using native web server
119122

120-
The `package.script` file contains comprehensive test scenarios that generate all combinations of ETag/gzip settings for validation.
123+
The `package.script` executable generates 36 test header files (9 combinations of etag/gzip × 4 engines) for comprehensive validation.
121124

122125
## Important Notes
123126

124127
- The tool processes entire directories recursively and embeds all files as binary data
125128
- Generated header files can be large but compile efficiently
126-
- Memory usage is optimized through const array placement in program memory
129+
- Memory usage is optimized through const array placement in program memory (ESP32) or PROGMEM (ESP8266)
127130
- The CLI is designed for CI/CD integration with npm packaging workflows
131+
- `index.html` or `index.htm` files are automatically set as the default route for "/"
132+
- Pre-compressed files (.gz, .br, .brottli) in the source directory are skipped if the original file exists
133+
- The build uses `--clean` and `--force` flags to ensure clean builds without incremental compilation
134+
135+
## Template System
136+
137+
The code generation uses Handlebars with custom helpers:
138+
139+
- **switch/case helpers**: Enable conditional C++ code generation based on etag/gzip settings
140+
- **Three-state options**: `etag` and `gzip` can be "true", "false", or "compiler" (for C++ directive control)
141+
- **Engine-specific templates**: Each engine (psychic, psychic2, async, espidf) has its own template in `src/cppCode.ts` or `src/cppCodeEspIdf.ts`
142+
- **Data transformation**: Binary content is converted to comma-separated byte arrays in the template data
143+
144+
## Generated C++ Defines
145+
146+
The generated header file includes C++ defines for build-time validation:
147+
148+
- `{PREFIX}_COUNT`: Total number of files
149+
- `{PREFIX}_SIZE`: Total uncompressed size in bytes
150+
- `{PREFIX}_SIZE_GZIP`: Total gzip compressed size in bytes
151+
- `{PREFIX}_FILE_{FILENAME}`: Define for each file (e.g., `SVELTEESP32_FILE_INDEX_HTML`)
152+
- `{PREFIX}_{EXT}_FILES`: Count of files by extension (e.g., `SVELTEESP32_CSS_FILES`)
153+
154+
These allow C++ code to verify expected files are present using `#ifndef` and `#error` directives.

0 commit comments

Comments
 (0)