@intuned/runtime-dev 1.3.17-cdp.0 → 1.3.17-import.0

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.
@@ -45,7 +45,7 @@ async function build(outfile, mode, template) {
45
45
  }), (0, _pluginTypescript.default)({
46
46
  tsconfig: `./intuned/${template}/tsconfig.json`
47
47
  }), (0, _pluginCommonjs.default)({
48
- include: ["node_modules/**", `intuned/${template}/**`, "dist", "../typescript-sdk/**", "../typescript-runtime/**"],
48
+ include: ["node_modules/**", `intuned/${template}/**`, "dist", "../typescript-runtime/**"],
49
49
  extensions: [".js"],
50
50
  ignoreGlobal: false,
51
51
  sourceMap: false,
@@ -21,6 +21,15 @@ const tsNodeImport = async apiName => {
21
21
  return (0, _neverthrow.ok)(imported);
22
22
  } catch (e) {
23
23
  if ("code" in e && e.code.includes("MODULE_NOT_FOUND")) {
24
+ if ("requireStack" in e && Array.isArray(e.requireStack)) {
25
+ const isStackTopThisFile = e.requireStack[0] === __filename;
26
+ if (!isStackTopThisFile) {
27
+ return (0, _neverthrow.err)({
28
+ type: "other",
29
+ error: e
30
+ });
31
+ }
32
+ }
24
33
  return (0, _neverthrow.err)({
25
34
  type: "not_found"
26
35
  });
@@ -48,7 +48,7 @@ async function executeRunApiCLI({
48
48
  ...rest
49
49
  });
50
50
  } catch (error) {
51
- if (error instanceof _runApi.AutomationError) {
51
+ if (error instanceof _runApi.RunAutomationError) {
52
52
  (0, _helpers.logAutomationError)(error);
53
53
  (0, _terminal.terminal)(`^r^+Attempt ${i + 1} failed^:\n`);
54
54
  continue;
@@ -1,5 +1,4 @@
1
1
  import * as playwright from "playwright";
2
- import { Result } from "neverthrow";
3
2
  export interface Proxy {
4
3
  server: string;
5
4
  username: string;
@@ -25,7 +24,6 @@ export declare function launchChromium(options: LaunchChromiumCdpOptions): Promi
25
24
  export declare function getBrowserExecutablePath(): Promise<string | undefined>;
26
25
  export declare function launchBrowser(options: Omit<LaunchChromiumStandaloneOptions, "executablePath"> | LaunchChromiumCdpOptions): Promise<LaunchBrowserResult>;
27
26
  export declare function getLocalCdpAddress(port: number): string;
28
- export declare function getCdpWebSocketUrl(cdpAddress: string): Promise<Result<string, string>>;
29
27
  export declare function getHeadlessUserAgent({ executablePath, args, ignoreDefaultArgs, }: {
30
28
  executablePath?: string;
31
29
  args?: string[];
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getBrowserExecutablePath = getBrowserExecutablePath;
7
- exports.getCdpWebSocketUrl = getCdpWebSocketUrl;
8
7
  exports.getHeadlessUserAgent = getHeadlessUserAgent;
9
8
  exports.getLocalCdpAddress = getLocalCdpAddress;
10
9
  exports.launchBrowser = launchBrowser;
@@ -18,8 +17,6 @@ var _child_process = require("child_process");
18
17
  var _extensionsHelpers = require("./extension/extensionsHelpers");
19
18
  var _intunedExtensionServer = require("./extension/intunedExtensionServer");
20
19
  var _util = require("util");
21
- var _neverthrow = require("neverthrow");
22
- var _zod = require("zod");
23
20
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
24
21
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
25
22
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -176,21 +173,6 @@ async function getBraveExecutablePath() {
176
173
  function getLocalCdpAddress(port) {
177
174
  return `http://localhost:${port}`;
178
175
  }
179
- async function getCdpWebSocketUrl(cdpAddress) {
180
- const response = await fetch(`${cdpAddress}/json/version`);
181
- if (!response.ok) {
182
- return (0, _neverthrow.err)(`Failed to get CDP WebSocket URL from ${cdpAddress}: ${response.status} ${response.statusText}`);
183
- }
184
- const data = await response.json();
185
- const cdpJsonVersionResponseSchema = _zod.z.object({
186
- webSocketDebuggerUrl: _zod.z.string().url()
187
- });
188
- const parseResult = cdpJsonVersionResponseSchema.safeParse(data);
189
- if (!parseResult.success) {
190
- return (0, _neverthrow.err)(`Invalid CDP version response from ${cdpAddress}: ${JSON.stringify(parseResult.error.format())}`);
191
- }
192
- return (0, _neverthrow.ok)(parseResult.data.webSocketDebuggerUrl);
193
- }
194
176
  async function waitOnCdpAddress(cdpAddress) {
195
177
  const cdpAddressWithoutProtocol = cdpAddress.replace("http://", "").replace("https://", "").replace("localhost", "127.0.0.1");
196
178
  await (0, _waitOn.default)({
@@ -71,6 +71,7 @@ async function withPlaywrightContext({
71
71
  const port = await (0, _portfinder.getPort)({
72
72
  port: 9222
73
73
  });
74
+ hookCdpUrl = (0, _launchBrowser.getLocalCdpAddress)(port);
74
75
  ({
75
76
  context,
76
77
  page
@@ -80,11 +81,6 @@ async function withPlaywrightContext({
80
81
  downloadsPath,
81
82
  cdpPort: port
82
83
  }));
83
- hookCdpUrl = (0, _launchBrowser.getLocalCdpAddress)(port);
84
- const wsUrlResult = await (0, _launchBrowser.getCdpWebSocketUrl)(hookCdpUrl);
85
- if (wsUrlResult.isOk()) {
86
- hookCdpUrl = wsUrlResult.value;
87
- }
88
84
  }
89
85
  let hookResult;
90
86
  try {
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.3.17-cdp.0",
3
+ "version": "1.3.17-import.0",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",