@witchcraft/nuxt-electron 0.4.6 → 0.4.7

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/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "electron",
3
3
  "configKey": "electron",
4
- "version": "0.4.6",
4
+ "version": "0.4.7",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.3",
7
7
  "unbuild": "3.6.1"
@@ -7,7 +7,7 @@ import type { Cookie } from "electron";
7
7
  */
8
8
  export declare function launchElectron({ appDir, userDataDir, serverUrl, useDevMode, bundlePrefix, env, extraArgs, windowTimeout }: {
9
9
  /** Points the app at serverUrl with VITE_DEV_SERVER_URL instead of at its bundlePrefix. Only works when the app leaves the windowUrl override open, so a baked production flag must be false. */
10
- useDevMode?: boolean;
10
+ useDevMode?: boolean | string;
11
11
  /** Directory the app is launched from, becomes the electron process cwd. A module playground passes its playground dir, an app passes its repo root. */
12
12
  appDir: string;
13
13
  /** Profile directory, it will be wiped before every launch. Point it somewhere gitignored. Must be within appDir for safety. */
@@ -1,7 +1,6 @@
1
1
  /**
2
- * The url the local dev server is reached on. https is used if LOCALHOST_KEY_PEM and LOCALHOST_PEM are set.
3
- *
4
- * Defaults to `http://localhost:${NUXT_POST ?? 3000}`
2
+ * The url the local dev server is reached on. https needs both LOCALHOST_KEY_PEM and LOCALHOST_PEM set, otherwise http.
5
3
  *
4
+ * Uses NUXT_PORT by default, override with an port from an env or a number. If the port is undefined, it will throw.
6
5
  */
7
6
  export declare function localhostUrl(port?: string | number): string;
@@ -1,4 +1,6 @@
1
- export function localhostUrl(port = process.env.NUXT_PORT ?? "3000") {
1
+ export function localhostUrl(port) {
2
+ const resolved = port ?? process.env.NUXT_PORT;
3
+ if (resolved === void 0) throw new Error("localhostUrl: pass a port or set NUXT_PORT.");
2
4
  const certs = process.env.LOCALHOST_KEY_PEM && process.env.LOCALHOST_PEM;
3
- return `${certs ? "https" : "http"}://localhost:${port}`;
5
+ return `${certs ? "https" : "http"}://localhost:${resolved}`;
4
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@witchcraft/nuxt-electron",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "Nuxt module for working with electron.",
5
5
  "repository": "https://github.com/witchcraftjs/nuxt-electron",
6
6
  "license": "MIT",
@@ -21,7 +21,7 @@ export function launchElectron({
21
21
  windowTimeout = 30_000
22
22
  }: {
23
23
  /** Points the app at serverUrl with VITE_DEV_SERVER_URL instead of at its bundlePrefix. Only works when the app leaves the windowUrl override open, so a baked production flag must be false. */
24
- useDevMode?: boolean
24
+ useDevMode?: boolean | string
25
25
  /** Directory the app is launched from, becomes the electron process cwd. A module playground passes its playground dir, an app passes its repo root. */
26
26
  appDir: string
27
27
  /** Profile directory, it will be wiped before every launch. Point it somewhere gitignored. Must be within appDir for safety. */
@@ -1,10 +1,13 @@
1
+ import type { Page } from "@playwright/test"
2
+
1
3
  /**
2
- * The url the local dev server is reached on. https is used if LOCALHOST_KEY_PEM and LOCALHOST_PEM are set.
3
- *
4
- * Defaults to `http://localhost:${NUXT_POST ?? 3000}`
4
+ * The url the local dev server is reached on. https needs both LOCALHOST_KEY_PEM and LOCALHOST_PEM set, otherwise http.
5
5
  *
6
+ * Uses NUXT_PORT by default, override with an port from an env or a number. If the port is undefined, it will throw.
6
7
  */
7
- export function localhostUrl(port: string | number = process.env.NUXT_PORT ?? "3000"): string {
8
+ export function localhostUrl(port?: string | number): string {
9
+ const resolved = port ?? process.env.NUXT_PORT
10
+ if (resolved === undefined) throw new Error("localhostUrl: pass a port or set NUXT_PORT.")
8
11
  const certs = process.env.LOCALHOST_KEY_PEM && process.env.LOCALHOST_PEM
9
- return `${certs ? "https" : "http"}://localhost:${port}`
12
+ return `${certs ? "https" : "http"}://localhost:${resolved}`
10
13
  }