@lwrjs/shared-utils 0.16.1-alpha.1 → 0.16.2

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.
@@ -27,7 +27,7 @@ __export(exports, {
27
27
  launch: () => launch
28
28
  });
29
29
  var import_os = __toModule(require("os"));
30
- async function launch(port, https) {
30
+ async function launch(port, https, path) {
31
31
  const {exec} = await Promise.resolve().then(() => __toModule(require("child_process")));
32
32
  let cmd = "open";
33
33
  if (process.platform == "win32") {
@@ -39,5 +39,9 @@ async function launch(port, https) {
39
39
  cmd = "xdg-open";
40
40
  }
41
41
  }
42
- exec(`${cmd} ${https ? "https" : "http"}://localhost:${port}`);
42
+ const finalPath = path ? path.startsWith("/") ? path : `/${path}` : "";
43
+ const protocol = https ? "https" : "http";
44
+ const url = `${protocol}://localhost:${port}${finalPath}`;
45
+ exec(`${cmd} ${url}`);
46
+ return url;
43
47
  }
@@ -4,5 +4,5 @@
4
4
  * @param port - the port number
5
5
  * @param https - if true, use https
6
6
  */
7
- export declare function launch(port: number, https?: boolean): Promise<void>;
7
+ export declare function launch(port: number, https?: boolean, path?: string): Promise<string>;
8
8
  //# sourceMappingURL=launch.d.ts.map
@@ -5,7 +5,7 @@ import { release } from 'os';
5
5
  * @param port - the port number
6
6
  * @param https - if true, use https
7
7
  */
8
- export async function launch(port, https) {
8
+ export async function launch(port, https, path) {
9
9
  const { exec } = await import('child_process');
10
10
  let cmd = 'open';
11
11
  if (process.platform == 'win32') {
@@ -19,6 +19,11 @@ export async function launch(port, https) {
19
19
  cmd = 'xdg-open';
20
20
  }
21
21
  }
22
- exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
22
+ // Ensure the path begins with '/' if provided
23
+ const finalPath = path ? (path.startsWith('/') ? path : `/${path}`) : '';
24
+ const protocol = https ? 'https' : 'http';
25
+ const url = `${protocol}://localhost:${port}${finalPath}`;
26
+ exec(`${cmd} ${url}`);
27
+ return url;
23
28
  }
24
29
  //# sourceMappingURL=launch.js.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.16.1-alpha.1",
7
+ "version": "0.16.2",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -37,7 +37,7 @@
37
37
  "build/**/*.d.ts"
38
38
  ],
39
39
  "dependencies": {
40
- "@lwrjs/diagnostics": "0.16.1-alpha.1",
40
+ "@lwrjs/diagnostics": "0.16.2",
41
41
  "es-module-lexer": "^1.5.4",
42
42
  "fast-json-stable-stringify": "^2.1.0",
43
43
  "magic-string": "^0.30.9",
@@ -50,7 +50,7 @@
50
50
  "slugify": "^1.4.5"
51
51
  },
52
52
  "devDependencies": {
53
- "@lwrjs/types": "0.16.1-alpha.1",
53
+ "@lwrjs/types": "0.16.2",
54
54
  "@types/mime-types": "2.1.4",
55
55
  "@types/path-to-regexp": "^1.7.0",
56
56
  "memfs": "^4.13.0"
@@ -58,5 +58,5 @@
58
58
  "engines": {
59
59
  "node": ">=18.0.0"
60
60
  },
61
- "gitHead": "59664adae64c581132e688c58569656f933a2daa"
61
+ "gitHead": "062cc0e7d23b70b1c97cdd8acde90caee4e644f8"
62
62
  }