svelteesp32 2.4.1 → 3.0.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 +89 -24
- package/bin/index.js +10 -1
- package/dist/commandLine.d.ts +9 -7
- package/dist/commandLine.js +22 -19
- package/dist/cppCode.d.ts +2 -1
- package/dist/cppCode.js +64 -64
- package/dist/cppCodeEspIdf.d.ts +1 -1
- package/dist/cppCodeEspIdf.js +13 -13
- package/dist/errorMessages.js +1 -1
- package/dist/file.d.ts +2 -1
- package/dist/file.js +8 -11
- package/dist/index.d.ts +1 -16
- package/dist/index.js +28 -221
- package/dist/initCommand.d.ts +1 -0
- package/dist/initCommand.js +55 -0
- package/dist/pipeline.d.ts +28 -0
- package/dist/pipeline.js +278 -0
- package/dist/vitePlugin.d.ts +34 -0
- package/dist/vitePlugin.js +55 -0
- package/package.json +32 -14
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
interface ResolvedViteConfig {
|
|
2
|
+
build: {
|
|
3
|
+
outDir: string;
|
|
4
|
+
};
|
|
5
|
+
}
|
|
6
|
+
interface VitePlugin {
|
|
7
|
+
name: string;
|
|
8
|
+
configResolved: (config: ResolvedViteConfig) => void;
|
|
9
|
+
closeBundle: () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface SvelteESP32PluginOptions {
|
|
12
|
+
output?: string;
|
|
13
|
+
sourcepath?: string;
|
|
14
|
+
engine?: 'psychic' | 'async' | 'espidf' | 'webserver';
|
|
15
|
+
etag?: 'always' | 'never' | 'compiler';
|
|
16
|
+
gzip?: 'always' | 'never' | 'compiler';
|
|
17
|
+
cachetime?: number;
|
|
18
|
+
cachetimehtml?: number;
|
|
19
|
+
cachetimeassets?: number;
|
|
20
|
+
exclude?: string[];
|
|
21
|
+
basepath?: string;
|
|
22
|
+
espmethod?: string;
|
|
23
|
+
define?: string;
|
|
24
|
+
version?: string;
|
|
25
|
+
created?: boolean;
|
|
26
|
+
spa?: boolean;
|
|
27
|
+
manifest?: boolean;
|
|
28
|
+
noindexcheck?: boolean;
|
|
29
|
+
maxsize?: number;
|
|
30
|
+
maxgzipsize?: number;
|
|
31
|
+
config?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function svelteESP32(options: SvelteESP32PluginOptions): VitePlugin;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
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 commandLine_1 = require("./commandLine");
|
|
9
|
+
const pipeline_1 = require("./pipeline");
|
|
10
|
+
function coerceBool(value) {
|
|
11
|
+
if (value === undefined)
|
|
12
|
+
return undefined;
|
|
13
|
+
return value === true || value === 'true';
|
|
14
|
+
}
|
|
15
|
+
function svelteESP32(options) {
|
|
16
|
+
let outDirectory = 'dist';
|
|
17
|
+
return {
|
|
18
|
+
name: 'svelteesp32',
|
|
19
|
+
configResolved(config) {
|
|
20
|
+
outDirectory = config.build.outDir;
|
|
21
|
+
},
|
|
22
|
+
closeBundle() {
|
|
23
|
+
const rcConfig = (0, commandLine_1.loadRcFileConfig)(options.config);
|
|
24
|
+
const rawOutput = options.output ?? rcConfig.outputfile;
|
|
25
|
+
if (!rawOutput)
|
|
26
|
+
throw new Error('output is required — specify it as a plugin option or in the RC file (outputfile)');
|
|
27
|
+
const outputfile = node_path_1.default.resolve(rawOutput);
|
|
28
|
+
const sourcepath = options.sourcepath ?? rcConfig.sourcepath ?? outDirectory;
|
|
29
|
+
const rawBasepath = options.basepath ?? rcConfig.basepath ?? '';
|
|
30
|
+
const basePath = (0, commandLine_1.validateBasePath)(rawBasepath);
|
|
31
|
+
const options_ = {
|
|
32
|
+
engine: options.engine ?? rcConfig.engine ?? 'psychic',
|
|
33
|
+
sourcepath,
|
|
34
|
+
outputfile,
|
|
35
|
+
etag: options.etag ?? rcConfig.etag ?? 'never',
|
|
36
|
+
gzip: options.gzip ?? rcConfig.gzip ?? 'always',
|
|
37
|
+
cachetime: options.cachetime ?? rcConfig.cachetime ?? 0,
|
|
38
|
+
cachetimeHtml: options.cachetimehtml ?? rcConfig.cachetimehtml,
|
|
39
|
+
cachetimeAssets: options.cachetimeassets ?? rcConfig.cachetimeassets,
|
|
40
|
+
created: options.created ?? coerceBool(rcConfig.created) ?? false,
|
|
41
|
+
version: options.version ?? rcConfig.version ?? '',
|
|
42
|
+
espmethod: options.espmethod ?? rcConfig.espmethod ?? 'initSvelteStaticFiles',
|
|
43
|
+
define: options.define ?? rcConfig.define ?? 'SVELTEESP32',
|
|
44
|
+
exclude: options.exclude ?? rcConfig.exclude ?? [],
|
|
45
|
+
basePath,
|
|
46
|
+
noIndexCheck: options.noindexcheck ?? coerceBool(rcConfig.noindexcheck),
|
|
47
|
+
spa: options.spa ?? coerceBool(rcConfig.spa),
|
|
48
|
+
manifest: options.manifest ?? coerceBool(rcConfig.manifest),
|
|
49
|
+
maxSize: options.maxsize ?? rcConfig.maxsize,
|
|
50
|
+
maxGzipSize: options.maxgzipsize ?? rcConfig.maxgzipsize
|
|
51
|
+
};
|
|
52
|
+
(0, pipeline_1.runPipeline)(options_);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelteesp32",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.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",
|
|
7
|
-
"exports":
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./vite": {
|
|
13
|
+
"types": "./dist/vitePlugin.d.ts",
|
|
14
|
+
"require": "./dist/vitePlugin.js",
|
|
15
|
+
"default": "./dist/vitePlugin.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
8
18
|
"main": "./dist/index.js",
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
19
|
"engines": {
|
|
11
|
-
"node": ">=
|
|
12
|
-
"npm": ">=
|
|
20
|
+
"node": ">=22",
|
|
21
|
+
"npm": ">=10"
|
|
13
22
|
},
|
|
14
23
|
"files": [
|
|
15
24
|
"bin/*.js",
|
|
@@ -28,9 +37,10 @@
|
|
|
28
37
|
},
|
|
29
38
|
"homepage": "https://github.com/BCsabaEngine/svelteesp32",
|
|
30
39
|
"scripts": {
|
|
31
|
-
"dev:async": "nodemon src/index.ts -- -e async -s ./demo/svelte/dist -o ./demo/esp32/include/svelteesp32.h --etag=
|
|
32
|
-
"dev:psychic": "nodemon src/index.ts -- -e psychic -s ./demo/svelte/dist -o ./demo/esp32/include/svelteesp32.h --etag=
|
|
33
|
-
"dev:webserver": "nodemon src/index.ts -- -e webserver -s ./demo/svelte/dist -o ./demo/esp32/include/svelteesp32.h --etag=
|
|
40
|
+
"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",
|
|
41
|
+
"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",
|
|
42
|
+
"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",
|
|
43
|
+
"dev:init": "tsx src/cliInit.mts",
|
|
34
44
|
"test": "vitest run",
|
|
35
45
|
"test:watch": "vitest",
|
|
36
46
|
"test:coverage": "vitest run --coverage",
|
|
@@ -49,36 +59,44 @@
|
|
|
49
59
|
},
|
|
50
60
|
"keywords": [
|
|
51
61
|
"svelte",
|
|
62
|
+
"svelte5",
|
|
52
63
|
"angular",
|
|
53
64
|
"react",
|
|
54
65
|
"vue",
|
|
55
|
-
"
|
|
66
|
+
"esp32",
|
|
56
67
|
"esp8266",
|
|
57
68
|
"webserver",
|
|
58
69
|
"psychichttpserver",
|
|
59
70
|
"espasyncwebserver"
|
|
60
71
|
],
|
|
61
72
|
"devDependencies": {
|
|
62
|
-
"@eslint/eslintrc": "^3.3.5",
|
|
63
73
|
"@eslint/js": "^10.0.1",
|
|
64
74
|
"@types/mime-types": "^3.0.1",
|
|
65
75
|
"@types/node": "^25.6.0",
|
|
66
76
|
"@types/picomatch": "^4.0.3",
|
|
67
|
-
"@typescript-eslint/eslint-plugin": "^8.59.
|
|
68
|
-
"@typescript-eslint/parser": "^8.59.
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^8.59.1",
|
|
78
|
+
"@typescript-eslint/parser": "^8.59.1",
|
|
69
79
|
"@vitest/coverage-v8": "^4.1.5",
|
|
70
|
-
"eslint": "^10.
|
|
80
|
+
"eslint": "^10.3.0",
|
|
71
81
|
"eslint-config-prettier": "^10.1.8",
|
|
72
82
|
"eslint-plugin-simple-import-sort": "^13.0.0",
|
|
73
83
|
"eslint-plugin-unicorn": "^64.0.0",
|
|
84
|
+
"globals": "^17.6.0",
|
|
74
85
|
"memfs": "^4.57.2",
|
|
75
86
|
"nodemon": "^3.1.14",
|
|
76
87
|
"prettier": "^3.8.3",
|
|
77
|
-
"ts-node": "^10.9.2",
|
|
78
88
|
"tsx": "^4.21.0",
|
|
79
89
|
"typescript": "^6.0.3",
|
|
80
90
|
"vitest": "^4.1.5"
|
|
81
91
|
},
|
|
92
|
+
"peerDependencies": {
|
|
93
|
+
"vite": ">=5"
|
|
94
|
+
},
|
|
95
|
+
"peerDependenciesMeta": {
|
|
96
|
+
"vite": {
|
|
97
|
+
"optional": true
|
|
98
|
+
}
|
|
99
|
+
},
|
|
82
100
|
"dependencies": {
|
|
83
101
|
"handlebars": "^4.7.9",
|
|
84
102
|
"mime-types": "^3.0.2",
|