@fluxlay/vite 1.0.3 → 1.0.5

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
@@ -7,7 +7,7 @@ Vite plugin for building [Fluxlay](https://fluxlay.com) wallpapers.
7
7
  ```sh
8
8
  npm install -D @fluxlay/vite
9
9
  # or
10
- pnpm add -D @fluxlay/vite
10
+ bun add -D @fluxlay/vite
11
11
  ```
12
12
 
13
13
  ## Usage
@@ -18,6 +18,6 @@ import { defineConfig } from "vite";
18
18
  import { fluxlay } from "@fluxlay/vite";
19
19
 
20
20
  export default defineConfig({
21
- plugins: [fluxlay()],
21
+ plugins: [fluxlay()]
22
22
  });
23
23
  ```
@@ -0,0 +1,12 @@
1
+ import { Plugin } from "vite";
2
+
3
+ //#region src/index.d.ts
4
+ /**
5
+ * Vite plugin for building Fluxlay plugins.
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.
9
+ */
10
+ declare function fluxlay(): Plugin;
11
+ //#endregion
12
+ export { fluxlay };
package/dist/index.mjs ADDED
@@ -0,0 +1,35 @@
1
+ //#region src/index.ts
2
+ /**
3
+ * Vite plugin for building Fluxlay plugins.
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.
7
+ */
8
+ function fluxlay() {
9
+ return {
10
+ name: "vite-plugin-fluxlay",
11
+ config(userConfig) {
12
+ const port = userConfig.server?.port ?? 5173;
13
+ return {
14
+ base: "./",
15
+ server: { hmr: {
16
+ host: "127.0.0.1",
17
+ protocol: "ws",
18
+ port,
19
+ clientPort: port
20
+ } },
21
+ build: {
22
+ outDir: "dist",
23
+ emptyOutDir: true,
24
+ minify: userConfig.build?.minify ?? "terser",
25
+ terserOptions: {
26
+ compress: { drop_console: true },
27
+ mangle: true
28
+ }
29
+ }
30
+ };
31
+ }
32
+ };
33
+ }
34
+ //#endregion
35
+ export { fluxlay };
package/package.json CHANGED
@@ -1,41 +1,41 @@
1
1
  {
2
2
  "name": "@fluxlay/vite",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Vite plugin for building Fluxlay wallpapers",
5
- "license": "SEE LICENSE IN LICENSE.txt",
6
- "homepage": "https://fluxlay.com",
7
5
  "keywords": [
8
6
  "fluxlay",
9
- "wallpaper",
7
+ "plugin",
10
8
  "vite",
11
- "plugin"
9
+ "wallpaper"
12
10
  ],
13
- "type": "module",
14
- "main": "./dist/index.js",
15
- "types": "./dist/index.d.ts",
11
+ "homepage": "https://fluxlay.com",
12
+ "license": "SEE LICENSE IN LICENSE.txt",
16
13
  "files": [
17
14
  "dist",
18
15
  "src"
19
16
  ],
17
+ "type": "module",
18
+ "main": "./dist/index.mjs",
19
+ "types": "./dist/index.d.mts",
20
20
  "exports": {
21
21
  ".": {
22
- "import": "./dist/index.js",
23
- "types": "./dist/index.d.ts"
22
+ "types": "./dist/index.d.mts",
23
+ "default": "./dist/index.mjs"
24
24
  }
25
25
  },
26
- "peerDependencies": {
27
- "vite": ">=7"
26
+ "scripts": {
27
+ "build": "tsdown",
28
+ "check": "oxlint --type-aware --type-check --fix && oxfmt --write ."
29
+ },
30
+ "dependencies": {
31
+ "terser": "^5.46.2"
28
32
  },
29
33
  "devDependencies": {
34
+ "tsdown": "^0.21.10",
30
35
  "typescript": "^5.9.3",
31
- "vite": "^7.3.1",
32
- "vite-plugin-dts": "^4.5.4"
33
- },
34
- "dependencies": {
35
- "terser": "^5.46.0"
36
+ "vite": "^8.0.10"
36
37
  },
37
- "scripts": {
38
- "build": "vite build",
39
- "check": "biome check --write"
38
+ "peerDependencies": {
39
+ "vite": ">=7"
40
40
  }
41
- }
41
+ }
package/src/index.ts CHANGED
@@ -2,24 +2,40 @@ 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,
16
32
  minify: userConfig.build?.minify ?? "terser",
17
33
  terserOptions: {
18
34
  compress: { drop_console: true },
19
- mangle: true,
20
- },
21
- },
35
+ mangle: true
36
+ }
37
+ }
22
38
  };
23
- },
39
+ }
24
40
  };
25
41
  }
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { Plugin } from 'vite';
2
- /**
3
- * Vite plugin for building Fluxlay plugins.
4
- * Enforces output directory and minification settings.
5
- */
6
- export declare function fluxlay(): Plugin;
package/dist/index.js DELETED
@@ -1,22 +0,0 @@
1
- function r() {
2
- return {
3
- name: "vite-plugin-fluxlay",
4
- config(e) {
5
- return {
6
- base: "./",
7
- build: {
8
- outDir: "dist",
9
- emptyOutDir: !0,
10
- minify: e.build?.minify ?? "terser",
11
- terserOptions: {
12
- compress: { drop_console: !0 },
13
- mangle: !0
14
- }
15
- }
16
- };
17
- }
18
- };
19
- }
20
- export {
21
- r as fluxlay
22
- };