npm package diff

Package: @forge/tunnel

Versions: 5.3.3-next.0-experimental-10722bc - 5.5.0-next.13

File: package/out/services/create-tunnel-service.js

Index: package/out/services/create-tunnel-service.js
===================================================================
--- package/out/services/create-tunnel-service.js
+++ package/out/services/create-tunnel-service.js
@@ -1,68 +1,13 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
-exports.NgrokCreateTunnelService = exports.CloudflareCreateTunnelService = exports.TunnelServiceFacade = exports.CloudflareError = exports.NgrokError = exports.USER_NGROK_ERRORS = void 0;
-const tslib_1 = require("tslib");
-const ngrok = tslib_1.__importStar(require("ngrok"));
+exports.CloudflareCreateTunnelService = exports.CloudflareError = void 0;
 const cloudflared_1 = require("cloudflared");
 const url_1 = require("url");
 const cli_shared_1 = require("@forge/cli-shared");
-const path_1 = tslib_1.__importDefault(require("path"));
-exports.USER_NGROK_ERRORS = [
-    'ERR_NGROK_105',
-    'ERR_NGROK_108',
-    'ERR_NGROK_120',
-    'ERR_NGROK_714',
-    'ERR_NGROK_715',
-    'ERR_NGROK_718',
-    'ERR_NGROK_720',
-    'ERR_NGROK_725',
-    'ERR_NGROK_726',
-    'ERR_NGROK_727',
-    'ERR_NGROK_728',
-    'ERR_NGROK_734',
-    'ERR_NGROK_1226',
-    'ERR_NGROK_3208',
-    'no such file or directory',
-    'The system cannot find the file specified',
-    'context canceled'
-];
-class NgrokError extends cli_shared_1.BaseError {
-    constructor(message) {
-        super(undefined, cli_shared_1.Text.tunnel.error.ngrok(message));
-    }
-    isUserError() {
-        return exports.USER_NGROK_ERRORS.some((err) => this.message.includes(err));
-    }
-}
-exports.NgrokError = NgrokError;
 class CloudflareError extends cli_shared_1.BaseError {
 }
 exports.CloudflareError = CloudflareError;
-class TunnelServiceFacade {
-    featureFlagService;
-    logger;
-    instance;
-    constructor(featureFlagService, logger) {
-        this.featureFlagService = featureFlagService;
-        this.logger = logger;
-    }
-    async getInstance() {
-        if (!this.instance) {
-            this.instance = (await this.featureFlagService.isCloudflareTunnelEnabled())
-                ? new CloudflareCreateTunnelService(this.logger)
-                : new NgrokCreateTunnelService(this.logger);
-        }
-        return this.instance;
-    }
-    async establishTunnel({ port, tunnelConfigPath, id, token, tunnelUrl }) {
-        return (await this.getInstance()).establishTunnel({ port, tunnelConfigPath, id, token, tunnelUrl });
-    }
-    async closeTunnel() {
-        return (await this.getInstance()).closeTunnel();
-    }
-}
-exports.TunnelServiceFacade = TunnelServiceFacade;
 class CloudflareCreateTunnelService {
     logger;
     stopFunction;
     constructor(logger) {
@@ -95,52 +40,4 @@
         }
     }
 }
 exports.CloudflareCreateTunnelService = CloudflareCreateTunnelService;
-class NgrokCreateTunnelService {
-    logger;
-    endpoint;
-    constructor(logger) {
-        this.logger = logger;
-    }
-    async establishTunnel({ port, tunnelConfigPath }) {
-        const defaultConfigPath = path_1.default.join(__dirname, '..', '..', 'config', 'ngrok.yml');
-        let ngrokErrorMessage = undefined;
-        try {
-            const options = {
-                addr: port,
-                configPath: tunnelConfigPath ?? defaultConfigPath,
-                onStatusChange: (status) => {
-                    this.logger.debug(cli_shared_1.Text.tunnel.tunnelStatusChange(status));
-                },
-                onLogEvent: (data) => {
-                    const errorMatch = /err=(".+")$/m.exec(data);
-                    if (errorMatch && !data.includes('obj=updater')) {
-                        ngrokErrorMessage = errorMatch[1];
-                        try {
-                            ngrokErrorMessage = JSON.parse(ngrokErrorMessage);
-                        }
-                        catch { }
-                    }
-                    this.logger.debug(data);
-                }
-            };
-            this.endpoint = await ngrok.connect(options);
-            this.logger.debug(cli_shared_1.Text.tunnel.startedTunnel(this.endpoint));
-            return new url_1.URL(this.endpoint);
-        }
-        catch (e) {
-            throw new NgrokError(ngrokErrorMessage);
-        }
-    }
-    async closeTunnel() {
-        if (this.endpoint) {
-            try {
-                await ngrok.disconnect();
-                await ngrok.kill();
-            }
-            catch { }
-            this.endpoint = undefined;
-        }
-    }
-}
-exports.NgrokCreateTunnelService = NgrokCreateTunnelService;