svelteesp32 1.2.0 → 1.2.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
@@ -12,7 +12,7 @@ This npm package provides a solution for **inserting any JS client application i
12
12
 
13
13
  > Starting with version v1.1.0, the ETag header is also supported.
14
14
 
15
- > Starting with version v1.3.0, ESP8266/ESP8285 is also supported.
15
+ > Starting with version v1.2.0, ESP8266/ESP8285 is also supported.
16
16
 
17
17
  ### Usage
18
18
 
package/dist/cppCode.js CHANGED
@@ -10,6 +10,10 @@ const psychicTemplate = `
10
10
  //files: {{fileCount}}
11
11
  //memory: {{fileSize}}
12
12
 
13
+ #include <Arduino.h>
14
+ #include <PsychicHttp.h>
15
+ #include <PsychicHttpsServer.h>
16
+
13
17
  {{#each sources}}
14
18
  const uint8_t data{{this.index}}[{{this.length}}] = { {{this.bytes}} };
15
19
  {{#if ../isEtag}}
@@ -49,6 +53,9 @@ const asyncTemplate = `
49
53
  //files: {{fileCount}}
50
54
  //memory: {{fileSize}}
51
55
 
56
+ #include <Arduino.h>
57
+ #include <ESPAsyncWebServer.h>
58
+
52
59
  {{#each sources}}
53
60
  const uint8_t data{{this.index}}[{{this.length}}] PROGMEM = { {{this.bytes}} };
54
61
  {{#if ../isEtag}}
package/dist/file.js CHANGED
@@ -4,7 +4,7 @@ exports.getFiles = void 0;
4
4
  const node_path_1 = require("node:path");
5
5
  const glob_1 = require("glob");
6
6
  const commandLine_1 = require("./commandLine");
7
- const getFiles = () => (0, glob_1.globSync)((0, node_path_1.join)('**/*'), { cwd: commandLine_1.cmdLine.sourcepath, nodir: true })
7
+ const getFiles = () => (0, glob_1.globSync)('**/*', { cwd: commandLine_1.cmdLine.sourcepath, nodir: true })
8
8
  .filter((filename) => !['.gz', '.brottli'].includes((0, node_path_1.extname)(filename)))
9
9
  .sort();
10
10
  exports.getFiles = getFiles;
package/dist/index.js CHANGED
@@ -15,7 +15,12 @@ const summary = {
15
15
  };
16
16
  const sources = [];
17
17
  let sourceIndex = 0;
18
- for (const file of (0, file_1.getFiles)()) {
18
+ const files = (0, file_1.getFiles)();
19
+ if (files.length === 0) {
20
+ console.error(`Directory ${commandLine_1.cmdLine.sourcepath} is empty`);
21
+ process.exit(1);
22
+ }
23
+ for (const file of files) {
19
24
  const mime = (0, mime_types_1.lookup)(file) || 'text/plain';
20
25
  summary.filecount++;
21
26
  console.log(`[${file}]`);
@@ -25,7 +30,7 @@ for (const file of (0, file_1.getFiles)()) {
25
30
  if (commandLine_1.cmdLine['no-gzip']) {
26
31
  sources.push({
27
32
  index: sourceIndex++,
28
- filename: file,
33
+ filename: file.replace(/\\/g, '/'),
29
34
  content: rawContent,
30
35
  isGzip: false,
31
36
  mime,
@@ -39,7 +44,7 @@ for (const file of (0, file_1.getFiles)()) {
39
44
  if (rawContent.length > 100 && zipContent.length < rawContent.length * 0.85) {
40
45
  sources.push({
41
46
  index: sourceIndex++,
42
- filename: file,
47
+ filename: file.replace(/\\/g, '/'),
43
48
  content: zipContent,
44
49
  isGzip: true,
45
50
  mime,
@@ -50,7 +55,7 @@ for (const file of (0, file_1.getFiles)()) {
50
55
  else {
51
56
  sources.push({
52
57
  index: sourceIndex++,
53
- filename: file,
58
+ filename: file.replace(/\\/g, '/'),
54
59
  content: rawContent,
55
60
  isGzip: false,
56
61
  mime,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteesp32",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
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",