@fluxlay/vite 1.0.4 → 1.0.6
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 +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.mjs +10 -1
- package/package.json +11 -11
- package/src/index.ts +17 -1
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,9 @@ import { Plugin } from "vite";
|
|
|
3
3
|
//#region src/index.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Vite plugin for building Fluxlay plugins.
|
|
6
|
-
* Enforces output directory and minification settings
|
|
6
|
+
* Enforces output directory and minification settings, and configures Vite's
|
|
7
|
+
* HMR client so it connects to the dev server's localhost origin (which the
|
|
8
|
+
* wallpaper CSP allows) rather than the wallpaper's custom-protocol origin.
|
|
7
9
|
*/
|
|
8
10
|
declare function fluxlay(): Plugin;
|
|
9
11
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
//#region src/index.ts
|
|
2
2
|
/**
|
|
3
3
|
* Vite plugin for building Fluxlay plugins.
|
|
4
|
-
* Enforces output directory and minification settings
|
|
4
|
+
* Enforces output directory and minification settings, and configures Vite's
|
|
5
|
+
* HMR client so it connects to the dev server's localhost origin (which the
|
|
6
|
+
* wallpaper CSP allows) rather than the wallpaper's custom-protocol origin.
|
|
5
7
|
*/
|
|
6
8
|
function fluxlay() {
|
|
7
9
|
return {
|
|
8
10
|
name: "vite-plugin-fluxlay",
|
|
9
11
|
config(userConfig) {
|
|
12
|
+
const port = userConfig.server?.port ?? 5173;
|
|
10
13
|
return {
|
|
11
14
|
base: "./",
|
|
15
|
+
server: { hmr: {
|
|
16
|
+
host: "127.0.0.1",
|
|
17
|
+
protocol: "ws",
|
|
18
|
+
port,
|
|
19
|
+
clientPort: port
|
|
20
|
+
} },
|
|
12
21
|
build: {
|
|
13
22
|
outDir: "dist",
|
|
14
23
|
emptyOutDir: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluxlay/vite",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Vite plugin for building Fluxlay wallpapers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fluxlay",
|
|
@@ -23,19 +23,19 @@
|
|
|
23
23
|
"default": "./dist/index.mjs"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsdown",
|
|
28
|
+
"check": "oxlint --type-aware --type-check --fix && oxfmt --write ."
|
|
29
|
+
},
|
|
26
30
|
"dependencies": {
|
|
27
|
-
"terser": "^5.
|
|
31
|
+
"terser": "^5.48.0"
|
|
28
32
|
},
|
|
29
33
|
"devDependencies": {
|
|
30
|
-
"tsdown": "^0.
|
|
31
|
-
"typescript": "^
|
|
32
|
-
"vite": "^8.0.
|
|
34
|
+
"tsdown": "^0.22.0",
|
|
35
|
+
"typescript": "^6.0.3",
|
|
36
|
+
"vite": "^8.0.14"
|
|
33
37
|
},
|
|
34
38
|
"peerDependencies": {
|
|
35
|
-
"vite": "
|
|
36
|
-
},
|
|
37
|
-
"scripts": {
|
|
38
|
-
"build": "tsdown",
|
|
39
|
-
"check": "oxlint --type-aware --type-check --fix && oxfmt --write ."
|
|
39
|
+
"vite": "^8.0.14"
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -2,14 +2,30 @@ import type { Plugin } from "vite";
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Vite plugin for building Fluxlay plugins.
|
|
5
|
-
* Enforces output directory and minification settings
|
|
5
|
+
* Enforces output directory and minification settings, and configures Vite's
|
|
6
|
+
* HMR client so it connects to the dev server's localhost origin (which the
|
|
7
|
+
* wallpaper CSP allows) rather than the wallpaper's custom-protocol origin.
|
|
6
8
|
*/
|
|
7
9
|
export function fluxlay(): Plugin {
|
|
8
10
|
return {
|
|
9
11
|
name: "vite-plugin-fluxlay",
|
|
10
12
|
config(userConfig) {
|
|
13
|
+
const port = userConfig.server?.port ?? 5173;
|
|
11
14
|
return {
|
|
12
15
|
base: "./",
|
|
16
|
+
server: {
|
|
17
|
+
// In dev mode the wallpaper webview is served via Tauri's custom
|
|
18
|
+
// protocol at origin `<label>.dev`. Vite's HMR client defaults to
|
|
19
|
+
// `new WebSocket("ws://" + location.host + "/?token=...")`, which
|
|
20
|
+
// resolves to `ws://<label>.dev/` and is blocked by the wallpaper
|
|
21
|
+
// CSP (only the actual Vite dev server is in `connect-src`).
|
|
22
|
+
//
|
|
23
|
+
// Pin the HMR endpoint to `127.0.0.1` — `@fluxlay/cli` registers the
|
|
24
|
+
// dev server URL with that exact host, and the wallpaper CSP is a
|
|
25
|
+
// string match (no DNS), so `localhost` would not pass. Users can
|
|
26
|
+
// still override by setting `server.hmr` in their own vite.config.
|
|
27
|
+
hmr: { host: "127.0.0.1", protocol: "ws", port, clientPort: port }
|
|
28
|
+
},
|
|
13
29
|
build: {
|
|
14
30
|
outDir: "dist",
|
|
15
31
|
emptyOutDir: true,
|