svelteesp32 2.4.0 → 2.4.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
@@ -89,9 +89,6 @@ void setup() {
89
89
  ## What's New
90
90
 
91
91
  - **v2.4.0** — `--analyze` for CI size budget checks (per-file table, exits 1 on over-budget); `--manifest` to write a companion JSON manifest alongside the header
92
- - **v2.3.3** — TypeScript 6 upgrade; `module`/`moduleResolution` updated to `Node16`, target raised to `ES2023`
93
- - **v2.3.2** — Security hardening: symlink traversal blocked, RC file CWD warning, absolute `outputfile` rejected in RC files, per-file 50 MB size limit
94
- - **v2.3.1** — Fixes: `--version` and `--basepath` input validation, `formatConfiguration` newline safety
95
92
  - **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)
96
93
  - **v2.2.0** — SPA routing catch-all (`--spa`) for client-side routers on all four engines
97
94
  - **v2.1.0** — New Arduino WebServer engine (`-e webserver`), dependency updates
@@ -588,6 +585,8 @@ Store your settings in `.svelteesp32rc.json` for zero-argument builds:
588
585
  }
589
586
  ```
590
587
 
588
+ Boolean fields (`noindexcheck`, `dryrun`, `analyze`, `spa`, `manifest`, `created`) accept native JSON booleans (`true`/`false`) or their string equivalents (`"true"`/`"false"`), matching the existing behaviour of `etag` and `gzip`.
589
+
591
590
  Then just run:
592
591
 
593
592
  ```bash
@@ -33,17 +33,17 @@ interface IRcFileConfig {
33
33
  cachetime?: number;
34
34
  cachetimehtml?: number;
35
35
  cachetimeassets?: number;
36
- created?: boolean;
36
+ created?: boolean | 'true' | 'false';
37
37
  version?: string;
38
38
  exclude?: string[];
39
39
  basepath?: string;
40
40
  maxsize?: number | string;
41
41
  maxgzipsize?: number | string;
42
- noindexcheck?: boolean;
43
- dryrun?: boolean;
44
- analyze?: boolean;
45
- spa?: boolean;
46
- manifest?: boolean;
42
+ noindexcheck?: boolean | 'true' | 'false';
43
+ dryrun?: boolean | 'true' | 'false';
44
+ analyze?: boolean | 'true' | 'false';
45
+ spa?: boolean | 'true' | 'false';
46
+ manifest?: boolean | 'true' | 'false';
47
47
  }
48
48
  declare function validateCppIdentifier(value: string, name: string): string;
49
49
  declare function parseSize(value: string, name: string): number;
@@ -333,15 +333,35 @@ function validateRcConfig(config, rcPath) {
333
333
  }
334
334
  validateSizeOption(configObject, 'maxsize');
335
335
  validateSizeOption(configObject, 'maxgzipsize');
336
- if (configObject['noindexcheck'] !== undefined && typeof configObject['noindexcheck'] !== 'boolean')
336
+ if (configObject['created'] !== undefined &&
337
+ typeof configObject['created'] !== 'boolean' &&
338
+ configObject['created'] !== 'true' &&
339
+ configObject['created'] !== 'false')
340
+ throw new TypeError(`Invalid created in RC file: ${configObject['created']} (must be boolean)`);
341
+ if (configObject['noindexcheck'] !== undefined &&
342
+ typeof configObject['noindexcheck'] !== 'boolean' &&
343
+ configObject['noindexcheck'] !== 'true' &&
344
+ configObject['noindexcheck'] !== 'false')
337
345
  throw new TypeError(`Invalid noindexcheck in RC file: ${configObject['noindexcheck']} (must be boolean)`);
338
- if (configObject['dryrun'] !== undefined && typeof configObject['dryrun'] !== 'boolean')
346
+ if (configObject['dryrun'] !== undefined &&
347
+ typeof configObject['dryrun'] !== 'boolean' &&
348
+ configObject['dryrun'] !== 'true' &&
349
+ configObject['dryrun'] !== 'false')
339
350
  throw new TypeError(`Invalid dryrun in RC file: ${configObject['dryrun']} (must be boolean)`);
340
- if (configObject['analyze'] !== undefined && typeof configObject['analyze'] !== 'boolean')
351
+ if (configObject['analyze'] !== undefined &&
352
+ typeof configObject['analyze'] !== 'boolean' &&
353
+ configObject['analyze'] !== 'true' &&
354
+ configObject['analyze'] !== 'false')
341
355
  throw new TypeError(`Invalid analyze in RC file: ${configObject['analyze']} (must be boolean)`);
342
- if (configObject['spa'] !== undefined && typeof configObject['spa'] !== 'boolean')
356
+ if (configObject['spa'] !== undefined &&
357
+ typeof configObject['spa'] !== 'boolean' &&
358
+ configObject['spa'] !== 'true' &&
359
+ configObject['spa'] !== 'false')
343
360
  throw new TypeError(`Invalid spa in RC file: ${configObject['spa']} (must be boolean)`);
344
- if (configObject['manifest'] !== undefined && typeof configObject['manifest'] !== 'boolean')
361
+ if (configObject['manifest'] !== undefined &&
362
+ typeof configObject['manifest'] !== 'boolean' &&
363
+ configObject['manifest'] !== 'true' &&
364
+ configObject['manifest'] !== 'false')
345
365
  throw new TypeError(`Invalid manifest in RC file: ${configObject['manifest']} (must be boolean)`);
346
366
  if (configObject['outputfile'] !== undefined && node_path_1.default.isAbsolute(configObject['outputfile']))
347
367
  throw new Error(`'outputfile' in RC file must be a relative path (use --output CLI flag for absolute paths): ${configObject['outputfile']}`);
@@ -400,7 +420,7 @@ function parseArguments() {
400
420
  if (rcConfig.cachetimeassets !== undefined)
401
421
  result.cachetimeAssets = rcConfig.cachetimeassets;
402
422
  if (rcConfig.created !== undefined)
403
- result.created = rcConfig.created;
423
+ result.created = rcConfig.created === true || rcConfig.created === 'true';
404
424
  if (rcConfig.version)
405
425
  result.version = rcConfig.version;
406
426
  if (rcConfig.espmethod)
@@ -414,15 +434,15 @@ function parseArguments() {
414
434
  if (rcConfig.maxgzipsize !== undefined)
415
435
  result.maxGzipSize = rcConfig.maxgzipsize;
416
436
  if (rcConfig.noindexcheck !== undefined)
417
- result.noIndexCheck = rcConfig.noindexcheck;
437
+ result.noIndexCheck = rcConfig.noindexcheck === true || rcConfig.noindexcheck === 'true';
418
438
  if (rcConfig.dryrun !== undefined)
419
- result.dryRun = rcConfig.dryrun;
439
+ result.dryRun = rcConfig.dryrun === true || rcConfig.dryrun === 'true';
420
440
  if (rcConfig.analyze !== undefined)
421
- result.analyze = rcConfig.analyze;
441
+ result.analyze = rcConfig.analyze === true || rcConfig.analyze === 'true';
422
442
  if (rcConfig.spa !== undefined)
423
- result.spa = rcConfig.spa;
443
+ result.spa = rcConfig.spa === true || rcConfig.spa === 'true';
424
444
  if (rcConfig.manifest !== undefined)
425
- result.manifest = rcConfig.manifest;
445
+ result.manifest = rcConfig.manifest === true || rcConfig.manifest === 'true';
426
446
  if (rcConfig.exclude && rcConfig.exclude.length > 0)
427
447
  result.exclude = [...rcConfig.exclude];
428
448
  const cliExclude = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteesp32",
3
- "version": "2.4.0",
3
+ "version": "2.4.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",