@lwrjs/shared-utils 0.13.0-alpha.4 → 0.13.0-alpha.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.
@@ -35,3 +35,4 @@ __exportStar(exports, __toModule(require("./env.cjs")));
35
35
  __exportStar(exports, __toModule(require("./lwr-app-observer.cjs")));
36
36
  __exportStar(exports, __toModule(require("./bundle.cjs")));
37
37
  __exportStar(exports, __toModule(require("./localization.cjs")));
38
+ __exportStar(exports, __toModule(require("./launch.cjs")));
@@ -0,0 +1,43 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, {get: all[name], enumerable: true});
11
+ };
12
+ var __exportStar = (target, module2, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && key !== "default")
16
+ __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
17
+ }
18
+ return target;
19
+ };
20
+ var __toModule = (module2) => {
21
+ return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
22
+ };
23
+
24
+ // packages/@lwrjs/shared-utils/src/launch.ts
25
+ __markAsModule(exports);
26
+ __export(exports, {
27
+ launch: () => launch
28
+ });
29
+ var import_os = __toModule(require("os"));
30
+ async function launch(port, https) {
31
+ const {exec} = await Promise.resolve().then(() => __toModule(require("child_process")));
32
+ let cmd = "open";
33
+ if (process.platform == "win32") {
34
+ cmd = "start";
35
+ } else if (process.platform == "linux") {
36
+ if (/microsoft/i.test((0, import_os.release)())) {
37
+ cmd = "cmd.exe /c start";
38
+ } else {
39
+ cmd = "xdg-open";
40
+ }
41
+ }
42
+ exec(`${cmd} ${https ? "https" : "http"}://localhost:${port}`);
43
+ }
@@ -14,4 +14,5 @@ export * from './env.js';
14
14
  export * from './lwr-app-observer.js';
15
15
  export * from './bundle.js';
16
16
  export * from './localization.js';
17
+ export * from './launch.js';
17
18
  //# sourceMappingURL=index.d.ts.map
package/build/es/index.js CHANGED
@@ -14,4 +14,5 @@ export * from './env.js';
14
14
  export * from './lwr-app-observer.js';
15
15
  export * from './bundle.js';
16
16
  export * from './localization.js';
17
+ export * from './launch.js';
17
18
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shared utility for launching a localhost browser window at a given port.
3
+ *
4
+ * @param port - the port number
5
+ * @param https - if true, use https
6
+ */
7
+ export declare function launch(port: number, https?: boolean): Promise<void>;
8
+ //# sourceMappingURL=launch.d.ts.map
@@ -0,0 +1,24 @@
1
+ import { release } from 'os';
2
+ /**
3
+ * Shared utility for launching a localhost browser window at a given port.
4
+ *
5
+ * @param port - the port number
6
+ * @param https - if true, use https
7
+ */
8
+ export async function launch(port, https) {
9
+ const { exec } = await import('child_process');
10
+ let cmd = 'open';
11
+ if (process.platform == 'win32') {
12
+ cmd = 'start';
13
+ }
14
+ else if (process.platform == 'linux') {
15
+ if (/microsoft/i.test(release())) {
16
+ cmd = 'cmd.exe /c start';
17
+ }
18
+ else {
19
+ cmd = 'xdg-open';
20
+ }
21
+ }
22
+ exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
23
+ }
24
+ //# sourceMappingURL=launch.js.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.13.0-alpha.4",
7
+ "version": "0.13.0-alpha.6",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -37,8 +37,8 @@
37
37
  "build/**/*.d.ts"
38
38
  ],
39
39
  "dependencies": {
40
- "@lwrjs/diagnostics": "0.13.0-alpha.4",
41
- "es-module-lexer": "^1.3.0",
40
+ "@lwrjs/diagnostics": "0.13.0-alpha.6",
41
+ "es-module-lexer": "^1.5.2",
42
42
  "fast-json-stable-stringify": "^2.1.0",
43
43
  "magic-string": "^0.30.9",
44
44
  "mime-types": "^2.1.33",
@@ -50,12 +50,12 @@
50
50
  "slugify": "^1.4.5"
51
51
  },
52
52
  "devDependencies": {
53
- "@lwrjs/types": "0.13.0-alpha.4",
53
+ "@lwrjs/types": "0.13.0-alpha.6",
54
54
  "@types/mime-types": "2.1.4",
55
55
  "@types/path-to-regexp": "^1.7.0"
56
56
  },
57
57
  "engines": {
58
58
  "node": ">=18.0.0"
59
59
  },
60
- "gitHead": "1a3c46bb34ab4f3501c118943b4297a95b6e4978"
60
+ "gitHead": "88d503249ff6b135416208763fae8a33b5e874de"
61
61
  }