svelteesp32 2.4.1 → 3.0.0

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.
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.svelteESP32 = svelteESP32;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const pipeline_1 = require("./pipeline");
9
+ function svelteESP32(options) {
10
+ let outDirectory = 'dist';
11
+ return {
12
+ name: 'svelteesp32',
13
+ configResolved(config) {
14
+ outDirectory = config.build.outDir;
15
+ },
16
+ closeBundle() {
17
+ const sourcepath = options.sourcepath ?? outDirectory;
18
+ const outputfile = node_path_1.default.resolve(options.output);
19
+ if (options.basepath !== undefined) {
20
+ const bp = options.basepath;
21
+ if (bp !== '' && !bp.startsWith('/'))
22
+ throw new Error(`basePath must start with /: ${bp}`);
23
+ if (bp.endsWith('/'))
24
+ throw new Error(`basePath must not end with /: ${bp}`);
25
+ if (bp.includes('//'))
26
+ throw new Error(`basePath must not contain //: ${bp}`);
27
+ if (bp.includes('"'))
28
+ throw new Error(`basePath must not contain double quotes: ${bp}`);
29
+ if (bp.includes('\\'))
30
+ throw new Error(`basePath must not contain backslashes: ${bp}`);
31
+ }
32
+ const options_ = {
33
+ engine: options.engine ?? 'psychic',
34
+ sourcepath,
35
+ outputfile,
36
+ etag: options.etag ?? 'never',
37
+ gzip: options.gzip ?? 'always',
38
+ cachetime: options.cachetime ?? 0,
39
+ cachetimeHtml: options.cachetimeHtml,
40
+ cachetimeAssets: options.cachetimeAssets,
41
+ created: options.created ?? false,
42
+ version: options.version ?? '',
43
+ espmethod: options.espmethod ?? 'initSvelteStaticFiles',
44
+ define: options.define ?? 'SVELTEESP32',
45
+ exclude: options.exclude ?? [],
46
+ basePath: options.basepath ?? '',
47
+ noIndexCheck: options.noIndexCheck,
48
+ spa: options.spa,
49
+ manifest: options.manifest,
50
+ maxSize: options.maxSize,
51
+ maxGzipSize: options.maxGzipSize
52
+ };
53
+ (0, pipeline_1.runPipeline)(options_);
54
+ }
55
+ };
56
+ }
package/package.json CHANGED
@@ -1,15 +1,23 @@
1
1
  {
2
2
  "name": "svelteesp32",
3
- "version": "2.4.1",
3
+ "version": "3.0.0",
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",
7
- "exports": "./dist/index.js",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./vite": {
13
+ "types": "./dist/vitePlugin.d.ts",
14
+ "default": "./dist/vitePlugin.js"
15
+ }
16
+ },
8
17
  "main": "./dist/index.js",
9
- "types": "./dist/index.d.ts",
10
18
  "engines": {
11
- "node": ">=20",
12
- "npm": ">=9"
19
+ "node": ">=22",
20
+ "npm": ">=10"
13
21
  },
14
22
  "files": [
15
23
  "bin/*.js",
@@ -28,9 +36,10 @@
28
36
  },
29
37
  "homepage": "https://github.com/BCsabaEngine/svelteesp32",
30
38
  "scripts": {
31
- "dev:async": "nodemon src/index.ts -- -e async -s ./demo/svelte/dist -o ./demo/esp32/include/svelteesp32.h --etag=true --gzip=true --cachetime=86400 --version=v$npm_package_version",
32
- "dev:psychic": "nodemon src/index.ts -- -e psychic -s ./demo/svelte/dist -o ./demo/esp32/include/svelteesp32.h --etag=false --gzip=false --version=v$npm_package_version",
33
- "dev:webserver": "nodemon src/index.ts -- -e webserver -s ./demo/svelte/dist -o ./demo/esp32/include/svelteesp32.h --etag=true --gzip=true --cachetime=86400 --version=v$npm_package_version",
39
+ "dev:async": "nodemon src/index.ts -- -e async -s ./demo/svelte/dist -o ./demo/esp32/include/svelteesp32.h --etag=always --gzip=always --cachetime=86400 --version=v$npm_package_version",
40
+ "dev:psychic": "nodemon src/index.ts -- -e psychic -s ./demo/svelte/dist -o ./demo/esp32/include/svelteesp32.h --etag=never --gzip=never --version=v$npm_package_version",
41
+ "dev:webserver": "nodemon src/index.ts -- -e webserver -s ./demo/svelte/dist -o ./demo/esp32/include/svelteesp32.h --etag=always --gzip=always --cachetime=86400 --version=v$npm_package_version",
42
+ "dev:init": "tsx src/cliInit.mts",
34
43
  "test": "vitest run",
35
44
  "test:watch": "vitest",
36
45
  "test:coverage": "vitest run --coverage",
@@ -49,36 +58,44 @@
49
58
  },
50
59
  "keywords": [
51
60
  "svelte",
61
+ "svelte5",
52
62
  "angular",
53
63
  "react",
54
64
  "vue",
55
- "eps32",
65
+ "esp32",
56
66
  "esp8266",
57
67
  "webserver",
58
68
  "psychichttpserver",
59
69
  "espasyncwebserver"
60
70
  ],
61
71
  "devDependencies": {
62
- "@eslint/eslintrc": "^3.3.5",
63
72
  "@eslint/js": "^10.0.1",
64
73
  "@types/mime-types": "^3.0.1",
65
74
  "@types/node": "^25.6.0",
66
75
  "@types/picomatch": "^4.0.3",
67
- "@typescript-eslint/eslint-plugin": "^8.59.0",
68
- "@typescript-eslint/parser": "^8.59.0",
76
+ "@typescript-eslint/eslint-plugin": "^8.59.1",
77
+ "@typescript-eslint/parser": "^8.59.1",
69
78
  "@vitest/coverage-v8": "^4.1.5",
70
- "eslint": "^10.2.1",
79
+ "eslint": "^10.3.0",
71
80
  "eslint-config-prettier": "^10.1.8",
72
81
  "eslint-plugin-simple-import-sort": "^13.0.0",
73
82
  "eslint-plugin-unicorn": "^64.0.0",
83
+ "globals": "^17.6.0",
74
84
  "memfs": "^4.57.2",
75
85
  "nodemon": "^3.1.14",
76
86
  "prettier": "^3.8.3",
77
- "ts-node": "^10.9.2",
78
87
  "tsx": "^4.21.0",
79
88
  "typescript": "^6.0.3",
80
89
  "vitest": "^4.1.5"
81
90
  },
91
+ "peerDependencies": {
92
+ "vite": ">=5"
93
+ },
94
+ "peerDependenciesMeta": {
95
+ "vite": {
96
+ "optional": true
97
+ }
98
+ },
82
99
  "dependencies": {
83
100
  "handlebars": "^4.7.9",
84
101
  "mime-types": "^3.0.2",