@forge/tunnel 4.0.8 → 4.1.0-next.1
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 +19 -0
- package/out/command/interactors/function-change-watcher.d.ts +4 -3
- package/out/command/interactors/function-change-watcher.d.ts.map +1 -1
- package/out/command/interactors/function-change-watcher.js +16 -4
- package/out/command/interactors/tunnel-interactor.d.ts +2 -2
- package/out/command/interactors/tunnel-interactor.d.ts.map +1 -1
- package/out/command/interactors/tunnel-interactor.js +3 -3
- package/out/command/start-tunnel-command.d.ts +2 -2
- package/out/command/start-tunnel-command.d.ts.map +1 -1
- package/out/command/start-tunnel-command.js +2 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @forge/tunnel
|
|
2
2
|
|
|
3
|
+
## 4.1.0-next.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c43a07c: enable nodejs runtime debugger
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [c43a07c]
|
|
12
|
+
- @forge/cli-shared@3.26.0-next.0
|
|
13
|
+
- @forge/runtime@5.6.0-next.0
|
|
14
|
+
- @forge/bundler@4.15.9-next.1
|
|
15
|
+
|
|
16
|
+
## 4.0.9-next.0
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- @forge/bundler@4.15.9-next.0
|
|
21
|
+
|
|
3
22
|
## 4.0.8
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ConfigFile, Logger } from '@forge/cli-shared';
|
|
1
|
+
import { ConfigFile, Logger, TunnelOptions } from '@forge/cli-shared';
|
|
2
2
|
import { BundlerOutput } from '@forge/bundler';
|
|
3
3
|
import { Sandbox, SandboxConfig, SnapshotCreator } from '@forge/runtime';
|
|
4
4
|
export interface FunctionChangeWatcher {
|
|
5
|
-
startWatching(bundledCode: BundlerOutput): Promise<void>;
|
|
5
|
+
startWatching(bundledCode: BundlerOutput, tunnelOptions: TunnelOptions): Promise<void>;
|
|
6
6
|
stopWatching(): Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
export interface Bundle {
|
|
@@ -20,9 +20,10 @@ export declare class LocalFunctionHost implements FunctionChangeWatcher {
|
|
|
20
20
|
private snapshotLogs;
|
|
21
21
|
constructor(configFile: ConfigFile, logger: Logger, snapshot: SnapshotCreator | null, createSandbox: (cfg: SandboxConfig) => Promise<Sandbox>);
|
|
22
22
|
private generateBundleFiles;
|
|
23
|
-
startWatching(bundledCode: BundlerOutput): Promise<void>;
|
|
23
|
+
startWatching(bundledCode: BundlerOutput, tunnelOptions?: TunnelOptions): Promise<void>;
|
|
24
24
|
stopWatching(): Promise<void>;
|
|
25
25
|
private onRuntimeLog;
|
|
26
26
|
private initializeSandboxes;
|
|
27
|
+
static getDebuggerPort(modName: string, handler: string, tunnelOptions: TunnelOptions): number | undefined;
|
|
27
28
|
}
|
|
28
29
|
//# sourceMappingURL=function-change-watcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function-change-watcher.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/function-change-watcher.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAA8B,MAAM,EAAqB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"function-change-watcher.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/function-change-watcher.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAA8B,MAAM,EAAqB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACrH,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,EAAE,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvF,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,MAAM;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uBAAuB,EAAE,MAAM,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC,qBAAa,iBAAkB,YAAW,qBAAqB;IAI3D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,aAAa;IANhC,OAAO,CAAC,YAAY,CAA8C;gBAG/C,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,eAAe,GAAG,IAAI,EAChC,aAAa,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC;YAG5D,mBAAmB;IA2BpB,aAAa,CAAC,WAAW,EAAE,aAAa,EAAE,aAAa,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkD3F,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,OAAO,CAAC,YAAY,CAElB;YAEY,mBAAmB;WAuBnB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa;CAY7F"}
|
|
@@ -39,7 +39,7 @@ class LocalFunctionHost {
|
|
|
39
39
|
await fs_1.promises.writeFile(bundle.bundleFileSourceMapPath, bundle.bundleFileSourceMap);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
async startWatching(bundledCode) {
|
|
42
|
+
async startWatching(bundledCode, tunnelOptions = {}) {
|
|
43
43
|
const directory = tmp_1.default.dirSync({ prefix: 'tunnel' }).name;
|
|
44
44
|
const isSnapshotEnabled = (await this.configFile.snapshotsEnabled()) && !((await this.configFile.runtimeType()) === cli_shared_1.RuntimeType.nodejs);
|
|
45
45
|
if (isSnapshotEnabled) {
|
|
@@ -78,13 +78,13 @@ class LocalFunctionHost {
|
|
|
78
78
|
this.logger.info('');
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
await this.initializeSandboxes(directory);
|
|
81
|
+
await this.initializeSandboxes(directory, tunnelOptions);
|
|
82
82
|
runtime_1.StaticInvocationEventEmitter.addListener(runtime_1.EVENT_P3_LOG, this.onRuntimeLog);
|
|
83
83
|
}
|
|
84
84
|
async stopWatching() {
|
|
85
85
|
runtime_1.StaticInvocationEventEmitter.removeAllListeners();
|
|
86
86
|
}
|
|
87
|
-
async initializeSandboxes(srcPath) {
|
|
87
|
+
async initializeSandboxes(srcPath, tunnelOptions) {
|
|
88
88
|
try {
|
|
89
89
|
const handlers = await this.configFile.getAppHandlers();
|
|
90
90
|
const sandboxes = {};
|
|
@@ -93,7 +93,8 @@ class LocalFunctionHost {
|
|
|
93
93
|
modName: module,
|
|
94
94
|
appPath: srcPath,
|
|
95
95
|
handler: func,
|
|
96
|
-
isolateMemory: exports.MEMORY_LIMIT
|
|
96
|
+
isolateMemory: exports.MEMORY_LIMIT,
|
|
97
|
+
debugPort: LocalFunctionHost.getDebuggerPort(module, func, tunnelOptions)
|
|
97
98
|
});
|
|
98
99
|
}));
|
|
99
100
|
util_1.SandboxesContainer.updateSandboxes(sandboxes);
|
|
@@ -102,5 +103,16 @@ class LocalFunctionHost {
|
|
|
102
103
|
this.logger.error(error);
|
|
103
104
|
}
|
|
104
105
|
}
|
|
106
|
+
static getDebuggerPort(modName, handler, tunnelOptions) {
|
|
107
|
+
const sandboxName = `${modName}.${handler}`;
|
|
108
|
+
if (!tunnelOptions || !tunnelOptions.debug) {
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
const index = (tunnelOptions.debugFunctionHandlers || []).findIndex((handler) => handler === sandboxName);
|
|
112
|
+
if (index === -1) {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
return index + (tunnelOptions.debugStartingPort || 9229);
|
|
116
|
+
}
|
|
105
117
|
}
|
|
106
118
|
exports.LocalFunctionHost = LocalFunctionHost;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { WatcherMonitor } from '@forge/bundler';
|
|
2
|
-
import { Logger } from '@forge/cli-shared';
|
|
2
|
+
import { Logger, TunnelOptions } from '@forge/cli-shared';
|
|
3
3
|
import { StartTunnelResult } from '../start-tunnel-command';
|
|
4
4
|
export declare class TunnelInteractor {
|
|
5
5
|
private readonly logger;
|
|
6
6
|
constructor(logger: Logger);
|
|
7
7
|
handleUserExitEvent(stopFunction: () => Promise<void>, bundleMonitor: WatcherMonitor | undefined): Promise<void>;
|
|
8
|
-
watchApp: (startTunnelResult: StartTunnelResult) => Promise<WatcherMonitor | undefined>;
|
|
8
|
+
watchApp: (startTunnelResult: StartTunnelResult, tunnelOptions?: TunnelOptions) => Promise<WatcherMonitor | undefined>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=tunnel-interactor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tunnel-interactor.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/tunnel-interactor.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAY,MAAM,EAAQ,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"tunnel-interactor.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/tunnel-interactor.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAY,MAAM,EAAQ,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAEpC,mBAAmB,CACxB,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EACjC,aAAa,EAAE,cAAc,GAAG,SAAS,GACxC,OAAO,CAAC,IAAI,CAAC;IAqCT,QAAQ,sBACM,iBAAiB,kBACrB,aAAa,KAC3B,QAAQ,cAAc,GAAG,SAAS,CAAC,CA6DpC;CACH"}
|
|
@@ -9,7 +9,7 @@ const multi_compiler_watcher_1 = require("./multi-compiler-watcher");
|
|
|
9
9
|
class TunnelInteractor {
|
|
10
10
|
constructor(logger) {
|
|
11
11
|
this.logger = logger;
|
|
12
|
-
this.watchApp = async (startTunnelResult) => {
|
|
12
|
+
this.watchApp = async (startTunnelResult, tunnelOptions = {}) => {
|
|
13
13
|
const { localPort, inspectorAddress, reloadSandboxes, devServers } = startTunnelResult;
|
|
14
14
|
if (inspectorAddress) {
|
|
15
15
|
this.logger.info(cli_shared_1.Text.tunnel.startedInspector(inspectorAddress));
|
|
@@ -31,7 +31,7 @@ class TunnelInteractor {
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
if (output) {
|
|
34
|
-
await reloadSandboxes(output);
|
|
34
|
+
await reloadSandboxes(output, tunnelOptions);
|
|
35
35
|
}
|
|
36
36
|
this.logger.info('');
|
|
37
37
|
this.logger.info(cli_shared_1.Text.tunnel.startedServer(localPort, this.logger.debugEnabled) + '\n');
|
|
@@ -47,7 +47,7 @@ class TunnelInteractor {
|
|
|
47
47
|
onBuildFinished: onBundlingFinish
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
await reloadSandboxes(output);
|
|
50
|
+
await reloadSandboxes(output, tunnelOptions);
|
|
51
51
|
this.logger.info('');
|
|
52
52
|
this.logger.info(cli_shared_1.Text.tunnel.startedServer(localPort, this.logger.debugEnabled) + '\n');
|
|
53
53
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BundlerOutput } from '@forge/bundler';
|
|
2
|
-
import { AppConfigProvider, ConfigFile, Logger } from '@forge/cli-shared';
|
|
2
|
+
import { AppConfigProvider, ConfigFile, Logger, TunnelOptions } from '@forge/cli-shared';
|
|
3
3
|
import { Inspector } from '@forge/runtime';
|
|
4
4
|
import { DevelopmentServer } from '../servers';
|
|
5
5
|
import { FunctionChangeWatcher } from './interactors';
|
|
@@ -18,7 +18,7 @@ export interface StartTunnelResult {
|
|
|
18
18
|
inspectorAddress?: string;
|
|
19
19
|
devServers: DevelopmentServer[];
|
|
20
20
|
stopFunction(): Promise<void>;
|
|
21
|
-
reloadSandboxes(bundledCode: BundlerOutput): Promise<void>;
|
|
21
|
+
reloadSandboxes(bundledCode: BundlerOutput, tunnelOptions: TunnelOptions): Promise<void>;
|
|
22
22
|
}
|
|
23
23
|
export declare class StartTunnelCommand {
|
|
24
24
|
private readonly getAppConfig;
|
|
@@ -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;
|
|
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,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAChH,OAAO,EAAE,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAG9D,OAAO,EACL,iBAAiB,EAKlB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,q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AS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU;IAGzC,OAAO,CAAC,YAAY,CAUlB;IAEF,OAAO,CAAC,qBAAqB,CAe3B;IAEF,OAAO,CAAC,gCAAgC,CAmCtC;IAEW,OAAO,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAoD9E"}
|
|
@@ -72,10 +72,10 @@ class StartTunnelCommand {
|
|
|
72
72
|
await this.tunnelClient.registerTunnels(appId, environmentKey, tunnelDefinitions);
|
|
73
73
|
const inspectorAddress = (0, index_1.isInspectorEnabled)() ? this.inspector.startServer(index_1.INSPECTOR_PORT) : undefined;
|
|
74
74
|
const stopFunction = async () => this.stopServices(appId, environmentKey);
|
|
75
|
-
const reloadSandboxes = async (bundledCode) => {
|
|
75
|
+
const reloadSandboxes = async (bundledCode, tunnelOptions) => {
|
|
76
76
|
await this.functionHost.stopWatching();
|
|
77
77
|
try {
|
|
78
|
-
await this.functionHost.startWatching(bundledCode);
|
|
78
|
+
await this.functionHost.startWatching(bundledCode, tunnelOptions);
|
|
79
79
|
}
|
|
80
80
|
catch (e) {
|
|
81
81
|
if (e instanceof runtime_1.SnapshotCodeError) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/tunnel",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.1.0-next.1",
|
|
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.15.
|
|
15
|
-
"@forge/cli-shared": "3.
|
|
14
|
+
"@forge/bundler": "4.15.9-next.1",
|
|
15
|
+
"@forge/cli-shared": "3.26.0-next.0",
|
|
16
16
|
"@forge/csp": "3.2.1",
|
|
17
|
-
"@forge/runtime": "5.
|
|
17
|
+
"@forge/runtime": "5.6.0-next.0",
|
|
18
18
|
"express": "^4.18.3",
|
|
19
19
|
"express-intercept": "^1.1.0",
|
|
20
20
|
"http-proxy-middleware": "^2.0.6",
|