@ricsam/r5d-browser 0.0.50 → 0.0.53
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 +16 -3
- package/dist/cjs/browser-runtime.cjs +295 -0
- package/dist/cjs/chrome-launcher.cjs +680 -0
- package/dist/cjs/cli-options.cjs +95 -0
- package/dist/cjs/main.cjs +172 -365
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/port-forward-manager.cjs +1 -1
- package/dist/mjs/browser-runtime.mjs +261 -0
- package/dist/mjs/chrome-launcher.mjs +637 -0
- package/dist/mjs/cli-options.mjs +60 -0
- package/dist/mjs/main.mjs +172 -365
- package/dist/mjs/package.json +1 -1
- package/dist/mjs/port-forward-manager.mjs +1 -1
- package/dist/types/browser-runtime.d.ts +36 -0
- package/dist/types/chrome-launcher.d.ts +53 -0
- package/dist/types/cli-options.d.ts +16 -0
- package/package.json +2 -2
- package/dist/cjs/playwright-install.cjs +0 -49
- package/dist/mjs/playwright-install.mjs +0 -15
- package/dist/types/playwright-install.d.ts +0 -1
|
@@ -0,0 +1,95 @@
|
|
|
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 cli_options_exports = {};
|
|
30
|
+
__export(cli_options_exports, {
|
|
31
|
+
defaultConfigPath: () => defaultConfigPath,
|
|
32
|
+
parseBrowserArgs: () => parseBrowserArgs
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(cli_options_exports);
|
|
35
|
+
var import_node_os = __toESM(require("node:os"), 1);
|
|
36
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
37
|
+
function defaultConfigPath() {
|
|
38
|
+
return import_node_path.default.join(import_node_os.default.homedir(), ".config", "r5d", "r5dctl", "config.json");
|
|
39
|
+
}
|
|
40
|
+
function parseBrowserArgs(argv) {
|
|
41
|
+
const options = { configPath: defaultConfigPath(), help: false, version: false };
|
|
42
|
+
const positionals = [];
|
|
43
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
44
|
+
const arg = argv[index];
|
|
45
|
+
if (!arg) continue;
|
|
46
|
+
if (arg === "-h" || arg === "--help") {
|
|
47
|
+
options.help = true;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (arg === "-v" || arg === "--version") {
|
|
51
|
+
options.version = true;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const readOption = (name) => {
|
|
55
|
+
if (arg === name) {
|
|
56
|
+
index += 1;
|
|
57
|
+
const value = argv[index];
|
|
58
|
+
if (!value || value.startsWith("--")) throw new Error(`Missing value for ${name}`);
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
return arg.startsWith(`${name}=`) ? arg.slice(name.length + 1) : void 0;
|
|
62
|
+
};
|
|
63
|
+
const entries = [
|
|
64
|
+
["--base-url", "baseUrl"],
|
|
65
|
+
["--token", "token"],
|
|
66
|
+
["--api-key", "apiKey"],
|
|
67
|
+
["--config", "configPath"],
|
|
68
|
+
["--profile", "profilePath"],
|
|
69
|
+
["--chrome-path", "chromePath"]
|
|
70
|
+
];
|
|
71
|
+
let matched = false;
|
|
72
|
+
for (const [name, key] of entries) {
|
|
73
|
+
const value = readOption(name);
|
|
74
|
+
if (value !== void 0) {
|
|
75
|
+
if (!value) throw new Error(`Missing value for ${name}`);
|
|
76
|
+
options[key] = value;
|
|
77
|
+
matched = true;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (matched) continue;
|
|
82
|
+
if (arg.startsWith("-")) throw new Error(`Unknown option: ${arg}`);
|
|
83
|
+
positionals.push(arg);
|
|
84
|
+
}
|
|
85
|
+
if (options.version) return { command: "version", options };
|
|
86
|
+
if (options.help || positionals.length === 0) return { command: "help", options };
|
|
87
|
+
if (positionals[0] !== "start") throw new Error(`Unknown command: ${positionals[0]}`);
|
|
88
|
+
if (positionals.length > 1) throw new Error(`Unexpected argument: ${positionals[1]}`);
|
|
89
|
+
return { command: "start", options };
|
|
90
|
+
}
|
|
91
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
+
0 && (module.exports = {
|
|
93
|
+
defaultConfigPath,
|
|
94
|
+
parseBrowserArgs
|
|
95
|
+
});
|