@forge/tunnel 3.0.1-next.2 → 3.1.0-next.3
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/CHANGELOG.md +12 -0
- package/out/command/interactors/function-change-watcher.d.ts +3 -2
- package/out/command/interactors/function-change-watcher.d.ts.map +1 -1
- package/out/command/interactors/function-change-watcher.js +6 -2
- package/out/command/start-tunnel-command.d.ts +1 -0
- package/out/command/start-tunnel-command.d.ts.map +1 -1
- package/out/command/start-tunnel-command.js +4 -4
- package/out/servers/custom-ui-tunnel-server.d.ts.map +1 -1
- package/out/servers/custom-ui-tunnel-server.js +2 -6
- package/out/servers/dev-server.d.ts +6 -2
- package/out/servers/dev-server.d.ts.map +1 -1
- package/out/servers/dev-server.js +17 -9
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @forge/tunnel
|
|
2
2
|
|
|
3
|
+
## 3.1.0-next.3
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d98339a: Non-Docker tunnel for Node runtime
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [d98339a]
|
|
12
|
+
- @forge/bundler@4.4.0-next.3
|
|
13
|
+
- @forge/runtime@4.0.1-next.0
|
|
14
|
+
|
|
3
15
|
## 3.0.1-next.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { MakeDirectoryOptions } from 'fs';
|
|
3
|
-
import { ConfigFile, Logger } from '@forge/cli-shared';
|
|
3
|
+
import { ConfigFile, FeatureFlagReader, Logger } from '@forge/cli-shared';
|
|
4
4
|
import { BundlerOutput } from '@forge/bundler';
|
|
5
5
|
import { Sandbox, SandboxConfig, SnapshotCreator } from '@forge/runtime';
|
|
6
6
|
export interface FunctionChangeWatcher {
|
|
@@ -25,8 +25,9 @@ export declare class LocalFunctionHost implements FunctionChangeWatcher {
|
|
|
25
25
|
private readonly snapshot;
|
|
26
26
|
private readonly createSandbox;
|
|
27
27
|
private readonly fsInteractor;
|
|
28
|
+
private readonly featureFlags;
|
|
28
29
|
private snapshotLogs;
|
|
29
|
-
constructor(configFile: ConfigFile, logger: Logger, snapshot: SnapshotCreator, createSandbox: (cfg: SandboxConfig) => Promise<Sandbox>, fsInteractor: FsInteractor);
|
|
30
|
+
constructor(configFile: ConfigFile, logger: Logger, snapshot: SnapshotCreator | null, createSandbox: (cfg: SandboxConfig) => Promise<Sandbox>, fsInteractor: FsInteractor, featureFlags: FeatureFlagReader);
|
|
30
31
|
private generateBundleFiles;
|
|
31
32
|
startWatching(bundledCode: BundlerOutput): Promise<void>;
|
|
32
33
|
stopWatching(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function-change-watcher.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/function-change-watcher.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAG1C,OAAO,EAAE,UAAU,EAA8B,MAAM,EAAQ,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"function-change-watcher.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/function-change-watcher.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAG1C,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAA8B,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAC5G,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAIL,OAAO,EACP,aAAa,EACb,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,WAAW,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,YAAY,IAAI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,13 @@ const util_1 = require("../../util");
|
|
|
10
10
|
exports.INVOCATION_TIMEOUT = 10;
|
|
11
11
|
exports.MEMORY_LIMIT = 256;
|
|
12
12
|
class LocalFunctionHost {
|
|
13
|
-
constructor(configFile, logger, snapshot, createSandbox, fsInteractor) {
|
|
13
|
+
constructor(configFile, logger, snapshot, createSandbox, fsInteractor, featureFlags) {
|
|
14
14
|
this.configFile = configFile;
|
|
15
15
|
this.logger = logger;
|
|
16
16
|
this.snapshot = snapshot;
|
|
17
17
|
this.createSandbox = createSandbox;
|
|
18
18
|
this.fsInteractor = fsInteractor;
|
|
19
|
+
this.featureFlags = featureFlags;
|
|
19
20
|
this.snapshotLogs = [];
|
|
20
21
|
this.onRuntimeLog = (event) => {
|
|
21
22
|
this.logger.info((0, util_1.formatRuntimeLog)(event));
|
|
@@ -24,6 +25,9 @@ class LocalFunctionHost {
|
|
|
24
25
|
async generateBundleFiles(bundle, withSnapshot) {
|
|
25
26
|
await this.fsInteractor.mkdir((0, path_1.dirname)(bundle.bundleFilePath), { recursive: true });
|
|
26
27
|
if (withSnapshot) {
|
|
28
|
+
if (!this.snapshot) {
|
|
29
|
+
throw new Error('Snapshot requested but snapshot creator not provided.');
|
|
30
|
+
}
|
|
27
31
|
const snapshotOutput = await this.snapshot({ isolateMemory: exports.MEMORY_LIMIT }, Buffer.from(bundle.bundleFileContent), bundle.bundleFilePath, bundle.bundleFileSourceMap ? Buffer.from(bundle.bundleFileSourceMap) : undefined);
|
|
28
32
|
await this.fsInteractor.writeFile(bundle.bundleFilePath + '.snapshot', Buffer.from(snapshotOutput.buffer));
|
|
29
33
|
if (snapshotOutput.logs.length > 0) {
|
|
@@ -39,7 +43,7 @@ class LocalFunctionHost {
|
|
|
39
43
|
}
|
|
40
44
|
async startWatching(bundledCode) {
|
|
41
45
|
const directory = tmp_1.default.dirSync({ prefix: 'tunnel' }).name;
|
|
42
|
-
const isSnapshotEnabled = await this.configFile.snapshotsEnabled();
|
|
46
|
+
const isSnapshotEnabled = (await this.configFile.snapshotsEnabled()) && !(await this.featureFlags.isNodeRuntime());
|
|
43
47
|
if (isSnapshotEnabled) {
|
|
44
48
|
this.logger.info('');
|
|
45
49
|
this.logger.info(cli_shared_1.Text.tunnel.preBundleTask(cli_shared_1.Text.tunnel.snapshotting));
|
|
@@ -8,6 +8,7 @@ import { RegisterTunnelService, CreateTunnelService } from '../services';
|
|
|
8
8
|
export interface StartTunnelOptions {
|
|
9
9
|
port?: number;
|
|
10
10
|
environmentKey: string;
|
|
11
|
+
resourcePortMap?: Record<string, number>;
|
|
11
12
|
}
|
|
12
13
|
export interface StartTunnelResult {
|
|
13
14
|
localPort: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-tunnel-command.d.ts","sourceRoot":"","sources":["../../src/command/start-tunnel-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,EAAyB,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAG9D,OAAO,EACL,iBAAiB,EAKlB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAsC,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACzE,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"start-tunnel-command.d.ts","sourceRoot":"","sources":["../../src/command/start-tunnel-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,EAAyB,MAAM,mBAAm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AAE,qBAAqB,EACnC,YAAY,EAAE,qBAAqB,EACnC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU;IAGzC,OAAO,CAAC,YAAY,CAUlB;IAEF,OAAO,CAAC,qBAAqB,CAS3B;IAEF,OAAO,CAAC,gCAAgC,CAiCtC;IAEW,OAAO,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAoD9E"}
|
|
@@ -36,9 +36,9 @@ class StartTunnelCommand {
|
|
|
36
36
|
const faasTunnelUrl = await this.tunnelFactory.establishTunnel(serverInfo.port);
|
|
37
37
|
return Object.assign(Object.assign({}, serverInfo), { tunnelUrl: faasTunnelUrl });
|
|
38
38
|
};
|
|
39
|
-
this.startResourceBasedTunnelsServers = async (resourceDetails) => {
|
|
39
|
+
this.startResourceBasedTunnelsServers = async (resourceDetails, resourcePortMap) => {
|
|
40
40
|
var _a, _b;
|
|
41
|
-
const
|
|
41
|
+
const portMap = resourcePortMap !== null && resourcePortMap !== void 0 ? resourcePortMap : JSON.parse((_a = process.env.RESOURCE_PORT_MAP) !== null && _a !== void 0 ? _a : '{}');
|
|
42
42
|
const { permissions = {}, remotes = [] } = await this.configFile.readConfig();
|
|
43
43
|
const cspReporterPort = parseInt((_b = process.env.CSP_REPORTER_PORT) !== null && _b !== void 0 ? _b : '4000', 10);
|
|
44
44
|
if (resourceDetails.length === 0)
|
|
@@ -47,7 +47,7 @@ class StartTunnelCommand {
|
|
|
47
47
|
await this.cspReporterServer.start();
|
|
48
48
|
return await Promise.all(resourceDetails.map(async (rd) => {
|
|
49
49
|
const { key, resourceType } = rd;
|
|
50
|
-
const port =
|
|
50
|
+
const port = portMap[key];
|
|
51
51
|
const tunnelServer = resourceType === 'nativeUI' ? servers_1.NativeUITunnelServer : servers_1.CustomUITunnelServer;
|
|
52
52
|
this.tunnelServers[key] = new tunnelServer(Object.assign(Object.assign({}, rd), { port, logger: this.logger, cspReporterServerPort: cspReporterPort, permissions,
|
|
53
53
|
remotes }));
|
|
@@ -61,7 +61,7 @@ class StartTunnelCommand {
|
|
|
61
61
|
const allResources = await this.configFile.getResources();
|
|
62
62
|
try {
|
|
63
63
|
const faasTunnelServer = await this.startFaaSTunnelServer(port);
|
|
64
|
-
const customUITunnelsServers = await this.startResourceBasedTunnelsServers(allResources);
|
|
64
|
+
const customUITunnelsServers = await this.startResourceBasedTunnelsServers(allResources, options.resourcePortMap);
|
|
65
65
|
const tunnelDefinitions = {
|
|
66
66
|
faasTunnelUrl: faasTunnelServer.tunnelUrl,
|
|
67
67
|
customUI: customUITunnelsServers.map(({ tunnelUrl, resourceKey }) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-ui-tunnel-server.d.ts","sourceRoot":"","sources":["../../src/servers/custom-ui-tunnel-server.ts"],"names":[],"mappings":"AAEA,OAAgB,EAAE,OAAO,EAAqB,MAAM,SAAS,CAAC;AAG9D,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAoB,MAAM,0BAA0B,CAAC;AAE5G,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"custom-ui-tunnel-server.d.ts","sourceRoot":"","sources":["../../src/servers/custom-ui-tunnel-server.ts"],"names":[],"mappings":"AAEA,OAAgB,EAAE,OAAO,EAAqB,MAAM,SAAS,CAAC;AAG9D,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAoB,MAAM,0BAA0B,CAAC;AAE5G,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAc,MAAM,cAAc,CAAC;AASnF,qBAAa,oBAAqB,SAAQ,oBAAqB,YAAW,iBAAiB;IAM7E,OAAO,CAAC,QAAQ,CAAC,UAAU;IALvC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAU;IAC9B,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA6B;IACnD,OAAO,CAAC,MAAM,CAAqB;gBAEN,UAAU,EAAE,wBAAwB;IAwC3D,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;IAkBhD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IASd,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC;IAK5C,MAAM,IAAI,OAAO;IAIjB,OAAO,CAAC,gCAAgC;IAoBxC,OAAO,CAAC,sBAAsB;CAO/B"}
|
|
@@ -7,6 +7,7 @@ const express_1 = tslib_1.__importDefault(require("express"));
|
|
|
7
7
|
const http_proxy_middleware_1 = require("http-proxy-middleware");
|
|
8
8
|
const resource_tunnel_server_1 = require("./resource-tunnel-server");
|
|
9
9
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
10
|
+
const dev_server_1 = require("./dev-server");
|
|
10
11
|
var ConnectionErrorCode;
|
|
11
12
|
(function (ConnectionErrorCode) {
|
|
12
13
|
ConnectionErrorCode["REFUSED"] = "ECONNREFUSED";
|
|
@@ -67,12 +68,7 @@ class CustomUITunnelServer extends resource_tunnel_server_1.ResourceTunnelServer
|
|
|
67
68
|
if (this.socket) {
|
|
68
69
|
this.socket.end();
|
|
69
70
|
}
|
|
70
|
-
|
|
71
|
-
if (!this.server) {
|
|
72
|
-
return resolve();
|
|
73
|
-
}
|
|
74
|
-
this.server.close((err) => (err ? reject(err) : resolve()));
|
|
75
|
-
});
|
|
71
|
+
await (0, dev_server_1.stopServer)(this.server);
|
|
76
72
|
}
|
|
77
73
|
async compileAndWatch() {
|
|
78
74
|
return {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import express from 'express';
|
|
4
|
+
import * as http from 'http';
|
|
3
5
|
import { URL } from 'url';
|
|
4
|
-
import { ConfigFile, Logger } from '@forge/cli-shared';
|
|
6
|
+
import { ConfigFile, FeatureFlagReader, Logger } from '@forge/cli-shared';
|
|
5
7
|
import { ExternalRequestBody } from '@forge/runtime';
|
|
6
8
|
import { Permissions, Remotes } from '@forge/manifest';
|
|
7
9
|
import { BundlerOutput } from '@forge/bundler';
|
|
@@ -23,15 +25,17 @@ export interface StartDevServerResult {
|
|
|
23
25
|
export interface InvocationService {
|
|
24
26
|
invoke(handler: string, request: ExternalRequestBody): Promise<any>;
|
|
25
27
|
}
|
|
28
|
+
export declare function stopServer(server: http.Server | undefined): Promise<void>;
|
|
26
29
|
export declare class LocalDevelopmentServer implements DevelopmentServer {
|
|
27
30
|
private readonly invocationService;
|
|
28
31
|
private readonly logger;
|
|
29
32
|
private readonly configFile;
|
|
33
|
+
private readonly featureFlags;
|
|
30
34
|
private app;
|
|
31
35
|
private httpServer;
|
|
32
36
|
private permissions;
|
|
33
37
|
private remotes;
|
|
34
|
-
constructor(invocationService: InvocationService, logger: Logger, configFile: ConfigFile);
|
|
38
|
+
constructor(invocationService: InvocationService, logger: Logger, configFile: ConfigFile, featureFlags: FeatureFlagReader);
|
|
35
39
|
start(port?: number, permissions?: Permissions, remotes?: Remotes): Promise<StartDevServerResult>;
|
|
36
40
|
stop(): Promise<void>;
|
|
37
41
|
compileAndWatch({ onBuildWillStart, onBuildFinished }: WatchHooks<BundlerOutput>): Promise<BundlerOutput | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/servers/dev-server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/servers/dev-server.ts"],"names":[],"mappings":";;AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAG1B,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAY,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAe,MAAM,gBAAgB,CAAC;AAGl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C,YAAY;IAT/B,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,UAAU,CAA0B;IAC5C,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,OAAO,CAAsB;gBAGlB,iBAAiB,EAAE,iBAAiB,EACpC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,iBAAiB;IAQrC,KAAK,CAAC,IAAI,SAAI,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAe5F,IAAI;IAIJ,eAAe,CAAC,EAC3B,gBAAgB,EAChB,eAAe,EAChB,EAAE,UAAU,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAqD1D,MAAM,IAAI,OAAO,CAAC,WAAW;IAI7B,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAsCtC;CACH"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LocalDevelopmentServer = void 0;
|
|
3
|
+
exports.LocalDevelopmentServer = exports.stopServer = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const express_1 = tslib_1.__importDefault(require("express"));
|
|
6
6
|
const bundler_1 = require("@forge/bundler");
|
|
@@ -9,11 +9,21 @@ const runtime_1 = require("@forge/runtime");
|
|
|
9
9
|
const __1 = require("../");
|
|
10
10
|
const util_1 = require("../util");
|
|
11
11
|
const bundler_2 = require("@forge/bundler");
|
|
12
|
+
async function stopServer(server) {
|
|
13
|
+
if (!server) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
return new Promise((resolve) => {
|
|
17
|
+
server.close(() => resolve());
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
exports.stopServer = stopServer;
|
|
12
21
|
class LocalDevelopmentServer {
|
|
13
|
-
constructor(invocationService, logger, configFile) {
|
|
22
|
+
constructor(invocationService, logger, configFile, featureFlags) {
|
|
14
23
|
this.invocationService = invocationService;
|
|
15
24
|
this.logger = logger;
|
|
16
25
|
this.configFile = configFile;
|
|
26
|
+
this.featureFlags = featureFlags;
|
|
17
27
|
this.handleInvocation = async (req, res) => {
|
|
18
28
|
var _a, _b, _c, _d, _e, _f;
|
|
19
29
|
const request = req.body;
|
|
@@ -61,12 +71,7 @@ class LocalDevelopmentServer {
|
|
|
61
71
|
};
|
|
62
72
|
}
|
|
63
73
|
async stop() {
|
|
64
|
-
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const server = this.httpServer;
|
|
68
|
-
this.httpServer = undefined;
|
|
69
|
-
await new Promise((resolve, reject) => server.close((err) => (err ? reject(err) : resolve())));
|
|
74
|
+
await stopServer(this.httpServer);
|
|
70
75
|
}
|
|
71
76
|
async compileAndWatch({ onBuildWillStart, onBuildFinished }) {
|
|
72
77
|
const handlers = await this.configFile.getAppHandlers();
|
|
@@ -74,7 +79,10 @@ class LocalDevelopmentServer {
|
|
|
74
79
|
if (!entryPoints.length) {
|
|
75
80
|
return;
|
|
76
81
|
}
|
|
77
|
-
const
|
|
82
|
+
const getConfig = (await this.featureFlags.isNodeRuntime())
|
|
83
|
+
? bundler_2.getNodeRuntimeBuildConfig
|
|
84
|
+
: bundler_2.getSandboxedRuntimeBuildConfig;
|
|
85
|
+
const config = getConfig(entryPoints, {
|
|
78
86
|
isWatchMode: true,
|
|
79
87
|
isDebugMode: (0, __1.isInspectorEnabled)(),
|
|
80
88
|
appDirectory: process.cwd()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/tunnel",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0-next.3",
|
|
4
4
|
"description": "Tunnel functionality for Forge CLI",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"compile": "tsc -b -v"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@forge/bundler": "4.4.0-next.
|
|
14
|
+
"@forge/bundler": "4.4.0-next.3",
|
|
15
15
|
"@forge/cli-shared": "3.5.1",
|
|
16
16
|
"@forge/csp": "^2.1.0",
|
|
17
|
-
"@forge/runtime": "4.0.0",
|
|
17
|
+
"@forge/runtime": "4.0.1-next.0",
|
|
18
18
|
"express": "^4.17.1",
|
|
19
19
|
"express-intercept": "^0.8.10",
|
|
20
20
|
"http-proxy-middleware": "^1.0.6",
|