svelteesp32 2.3.0 → 2.3.1

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
@@ -80,8 +80,6 @@ void setup() {
80
80
  ## What's New
81
81
 
82
82
  - **v2.3.0** — `--cachetime-html` and `--cachetime-assets` for per-type cache control (e.g. `no-cache` for HTML, 1-year for content-hashed JS/CSS)
83
- - **v2.2.2** — `static const` data/ETag arrays prevent multi-TU linker collisions; `SVELTEESP32_MAX_URI_HANDLERS` define added for psychic engine; default exclude patterns removed (now explicit-only)
84
- - **v2.2.1** — Enhanced `--dryrun` output: engine/ETag/gzip/SPA summary header + aligned route table with MIME types, sizes, and tags (`[default]`, `[no gzip]`, `[SPA catch-all]`)
85
83
  - **v2.2.0** — SPA routing catch-all (`--spa`) for client-side routers on all four engines
86
84
  - **v2.1.0** — New Arduino WebServer engine (`-e webserver`), dependency updates
87
85
  - **v2.0.0** — **BREAKING**: PsychicHttpServer V2 is now the default `psychic` engine. The `psychic2` engine has been removed. Dry run mode, C++ identifier validation, improved MIME type warnings
@@ -94,6 +94,15 @@ function validateBasePath(value) {
94
94
  throw new Error(`basePath must not end with /: ${value}`);
95
95
  if (value.includes('//'))
96
96
  throw new Error(`basePath must not contain //: ${value}`);
97
+ if (value.includes('"'))
98
+ throw new Error(`basePath must not contain double quotes: ${value}`);
99
+ if (value.includes('\\'))
100
+ throw new Error(`basePath must not contain backslashes: ${value}`);
101
+ return value;
102
+ }
103
+ function validateVersion(value) {
104
+ if (!/^[\w+.-]+$/.test(value))
105
+ throw new Error(`version must only contain word characters, dots, hyphens, and plus signs: ${value}`);
97
106
  return value;
98
107
  }
99
108
  function parseSize(value, name) {
@@ -420,7 +429,7 @@ function parseArguments() {
420
429
  result.gzip = validateTriState(value, 'gzip');
421
430
  break;
422
431
  case 'version':
423
- result.version = value;
432
+ result.version = validateVersion(value);
424
433
  break;
425
434
  case 'espmethod':
426
435
  result.espmethod = validateCppIdentifier(value, 'espmethod');
@@ -576,7 +585,7 @@ function formatConfiguration(cmdLine) {
576
585
  parts.push(`spa=${cmdLine.spa}`);
577
586
  if (cmdLine.exclude.length > 0)
578
587
  parts.push(`exclude=[${cmdLine.exclude.join(', ')}]`);
579
- return parts.join(' ');
588
+ return parts.join(' ').replace(/[\n\r]/g, ' ');
580
589
  }
581
590
  exports.cmdLine = parseArguments();
582
591
  if (!(0, node_fs_1.existsSync)(exports.cmdLine.sourcepath)) {
package/dist/index.js CHANGED
@@ -115,9 +115,10 @@ function main() {
115
115
  const longestFilename = [...files.keys()].reduce((p, c) => Math.max(c.length, p), 0);
116
116
  for (const [originalFilename, fileData] of files) {
117
117
  const { content, hash: sha256 } = fileData;
118
- const mimeType = (0, mime_types_1.lookup)(originalFilename) || 'text/plain';
119
- if (!(0, mime_types_1.lookup)(originalFilename))
118
+ const rawMime = (0, mime_types_1.lookup)(originalFilename);
119
+ if (!rawMime)
120
120
  console.log((0, consoleColor_1.yellowLog)(` [${originalFilename}] unknown MIME type for extension '${node_path_1.default.extname(originalFilename)}', using text/plain`));
121
+ const mimeType = rawMime || 'text/plain';
121
122
  summary.filecount++;
122
123
  const filename = originalFilename.replace(/\\/g, '/');
123
124
  let dataname = filename.replace(/\W/g, '_');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteesp32",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Convert Svelte (or any frontend) JS application to serve it from ESP32 webserver (PsychicHttp)",
5
5
  "author": "BCsabaEngine",
6
6
  "license": "ISC",