@ricsam/r5d-browser 0.0.43 → 0.0.44

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/cjs/main.cjs CHANGED
@@ -25,10 +25,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  var import_node_fs = __toESM(require("node:fs"), 1);
26
26
  var import_node_os = __toESM(require("node:os"), 1);
27
27
  var import_node_path = __toESM(require("node:path"), 1);
28
- var import_node_module = require("node:module");
29
28
  var import_node_child_process = require("node:child_process");
30
29
  var import_promises = require("node:timers/promises");
31
30
  var import_ws = __toESM(require("ws"), 1);
31
+ var import_playwright_install = require("./playwright-install.cjs");
32
32
  const DEFAULT_BASE_URL = "https://r5d.dev";
33
33
  const PACKAGE_NAME = "@ricsam/r5d-browser";
34
34
  const RECONNECT_DELAY_MS = 2e3;
@@ -146,8 +146,7 @@ function resolveConnection(options) {
146
146
  function installChromium(browsersPath) {
147
147
  import_node_fs.default.mkdirSync(browsersPath, { recursive: true });
148
148
  process.env.PLAYWRIGHT_BROWSERS_PATH = browsersPath;
149
- const require2 = (0, import_node_module.createRequire)(process.argv[1] ?? import_node_path.default.join(process.cwd(), "package.json"));
150
- const cliPath = require2.resolve("playwright/cli");
149
+ const cliPath = (0, import_playwright_install.resolvePlaywrightCliPath)();
151
150
  process.stdout.write(`[r5d-browser] Installing Chromium under ${browsersPath}...
152
151
  `);
153
152
  const result = (0, import_node_child_process.spawnSync)(process.execPath, [cliPath, "install", "chromium"], {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-browser",
3
- "version": "0.0.43",
3
+ "version": "0.0.44",
4
4
  "type": "commonjs"
5
5
  }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var playwright_install_exports = {};
30
+ __export(playwright_install_exports, {
31
+ resolvePlaywrightCliPath: () => resolvePlaywrightCliPath
32
+ });
33
+ module.exports = __toCommonJS(playwright_install_exports);
34
+ var import_node_fs = __toESM(require("node:fs"), 1);
35
+ var import_node_path = __toESM(require("node:path"), 1);
36
+ var import_node_module = require("node:module");
37
+ function resolvePlaywrightCliPath(fromPath = process.argv[1] ?? import_node_path.default.join(process.cwd(), "package.json")) {
38
+ const require2 = (0, import_node_module.createRequire)(fromPath);
39
+ const packageJsonPath = require2.resolve("playwright/package.json");
40
+ const cliPath = import_node_path.default.join(import_node_path.default.dirname(packageJsonPath), "cli.js");
41
+ if (!import_node_fs.default.existsSync(cliPath)) {
42
+ throw new Error(`The Playwright CLI was not found next to ${packageJsonPath}. Reinstall @ricsam/r5d-browser.`);
43
+ }
44
+ return cliPath;
45
+ }
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ resolvePlaywrightCliPath
49
+ });
package/dist/mjs/main.mjs CHANGED
@@ -2,10 +2,10 @@
2
2
  import fs from "node:fs";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
- import { createRequire } from "node:module";
6
5
  import { spawnSync } from "node:child_process";
7
6
  import { setTimeout as sleep } from "node:timers/promises";
8
7
  import WebSocket from "ws";
8
+ import { resolvePlaywrightCliPath } from "./playwright-install.mjs";
9
9
  const DEFAULT_BASE_URL = "https://r5d.dev";
10
10
  const PACKAGE_NAME = "@ricsam/r5d-browser";
11
11
  const RECONNECT_DELAY_MS = 2e3;
@@ -123,8 +123,7 @@ function resolveConnection(options) {
123
123
  function installChromium(browsersPath) {
124
124
  fs.mkdirSync(browsersPath, { recursive: true });
125
125
  process.env.PLAYWRIGHT_BROWSERS_PATH = browsersPath;
126
- const require2 = createRequire(process.argv[1] ?? path.join(process.cwd(), "package.json"));
127
- const cliPath = require2.resolve("playwright/cli");
126
+ const cliPath = resolvePlaywrightCliPath();
128
127
  process.stdout.write(`[r5d-browser] Installing Chromium under ${browsersPath}...
129
128
  `);
130
129
  const result = spawnSync(process.execPath, [cliPath, "install", "chromium"], {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-browser",
3
- "version": "0.0.43",
3
+ "version": "0.0.44",
4
4
  "type": "module"
5
5
  }
@@ -0,0 +1,15 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { createRequire } from "node:module";
4
+ function resolvePlaywrightCliPath(fromPath = process.argv[1] ?? path.join(process.cwd(), "package.json")) {
5
+ const require2 = createRequire(fromPath);
6
+ const packageJsonPath = require2.resolve("playwright/package.json");
7
+ const cliPath = path.join(path.dirname(packageJsonPath), "cli.js");
8
+ if (!fs.existsSync(cliPath)) {
9
+ throw new Error(`The Playwright CLI was not found next to ${packageJsonPath}. Reinstall @ricsam/r5d-browser.`);
10
+ }
11
+ return cliPath;
12
+ }
13
+ export {
14
+ resolvePlaywrightCliPath
15
+ };
@@ -0,0 +1 @@
1
+ export declare function resolvePlaywrightCliPath(fromPath?: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-browser",
3
- "version": "0.0.43",
3
+ "version": "0.0.44",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/main.cjs",
6
6
  "module": "./dist/mjs/main.mjs",