@forge/tunnel 5.6.1-next.0 → 5.7.0-next.10

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 CHANGED
@@ -1,5 +1,84 @@
1
1
  # @forge/tunnel
2
2
 
3
+ ## 5.7.0-next.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [34fe2fa]
8
+ - @forge/cli-shared@6.4.0-next.8
9
+ - @forge/bundler@4.20.1-next.9
10
+
11
+ ## 5.7.0-next.9
12
+
13
+ ### Patch Changes
14
+
15
+ - @forge/bundler@4.20.1-next.8
16
+ - @forge/cli-shared@6.4.0-next.7
17
+
18
+ ## 5.7.0-next.8
19
+
20
+ ### Patch Changes
21
+
22
+ - 34e19bb: Refactor Bundler to support watching
23
+ - Updated dependencies [34e19bb]
24
+ - @forge/bundler@4.20.1-next.7
25
+
26
+ ## 5.7.0-next.7
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [a2eed13]
31
+ - @forge/cli-shared@6.4.0-next.6
32
+ - @forge/bundler@4.20.1-next.6
33
+
34
+ ## 5.7.0-next.6
35
+
36
+ ### Patch Changes
37
+
38
+ - Updated dependencies [85663fe]
39
+ - @forge/cli-shared@6.4.0-next.5
40
+ - @forge/bundler@4.20.1-next.5
41
+
42
+ ## 5.7.0-next.5
43
+
44
+ ### Patch Changes
45
+
46
+ - @forge/bundler@4.20.1-next.4
47
+ - @forge/cli-shared@6.4.0-next.4
48
+
49
+ ## 5.7.0-next.4
50
+
51
+ ### Patch Changes
52
+
53
+ - @forge/bundler@4.20.1-next.3
54
+ - @forge/cli-shared@6.4.0-next.3
55
+
56
+ ## 5.7.0-next.3
57
+
58
+ ### Patch Changes
59
+
60
+ - Updated dependencies [4fa9673]
61
+ - @forge/csp@3.4.0-next.0
62
+
63
+ ## 5.7.0-next.2
64
+
65
+ ### Minor Changes
66
+
67
+ - fa239b2: Error handling and logging for the cloudflared process used by tunnel
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies [fa239b2]
72
+ - @forge/cli-shared@6.4.0-next.2
73
+ - @forge/bundler@4.20.1-next.2
74
+
75
+ ## 5.6.1-next.1
76
+
77
+ ### Patch Changes
78
+
79
+ - @forge/bundler@4.20.1-next.1
80
+ - @forge/cli-shared@6.3.1-next.1
81
+
3
82
  ## 5.6.1-next.0
4
83
 
5
84
  ### Patch Changes
@@ -1,13 +1,14 @@
1
- import { BundlerOutput, WatcherMonitor } from '@forge/bundler';
2
- import { DevelopmentServer, WatchHooks } from '../../servers';
1
+ import { BundlerOutput, BundlerWatch, WatcherMonitor } from '@forge/bundler';
2
+ import { DevelopmentServer } from '../../servers';
3
3
  import { TunnelOptions } from '@forge/cli-shared';
4
4
  export declare class MultiCompilerWatcher implements WatcherMonitor {
5
5
  private readonly faasServer;
6
6
  private readonly uiServers;
7
7
  constructor(faasServer: DevelopmentServer, uiServers: DevelopmentServer[]);
8
8
  allServers(): DevelopmentServer[];
9
- compileAndWatch({ onChange: { onBuildWillStart, onBuildFinished } }: {
10
- onChange: WatchHooks;
9
+ compileAndWatch({ onRuntimeChange, onUIChange }: {
10
+ onRuntimeChange: BundlerWatch;
11
+ onUIChange: BundlerWatch;
11
12
  }, tunnelOptions?: TunnelOptions): Promise<BundlerOutput>;
12
13
  stop(): Promise<void>;
13
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"multi-compiler-watcher.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/multi-compiler-watcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAA+B,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE/E,qBAAa,oBAAqB,YAAW,cAAc;IAEvD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS;gBADT,UAAU,EAAE,iBAAiB,EAC7B,SAAS,EAAE,iBAAiB,EAAE;IAG1C,UAAU,IAAI,iBAAiB,EAAE;IAI3B,eAAe,CAC1B,EACE,QAAQ,EAAE,EAAE,gBAAgB,EAAE,eAAe,EAAE,EAChD,EAAE;QACD,QAAQ,EAAE,UAAU,CAAC;KACtB,EACD,aAAa,GAAE,aAA2C,GACzD,OAAO,CAAC,aAAa,CAAC;IAgBZ,IAAI;CAGlB"}
1
+ {"version":3,"file":"multi-compiler-watcher.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/multi-compiler-watcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAA+B,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE/E,qBAAa,oBAAqB,YAAW,cAAc;IAEvD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS;gBADT,UAAU,EAAE,iBAAiB,EAC7B,SAAS,EAAE,iBAAiB,EAAE;IAG1C,UAAU,IAAI,iBAAiB,EAAE;IAI3B,eAAe,CAC1B,EACE,eAAe,EACf,UAAU,EACX,EAAE;QACD,eAAe,EAAE,YAAY,CAAC;QAC9B,UAAU,EAAE,YAAY,CAAC;KAC1B,EACD,aAAa,GAAE,aAA2C,GACzD,OAAO,CAAC,aAAa,CAAC;IASZ,IAAI;CAGlB"}
@@ -12,11 +12,11 @@ class MultiCompilerWatcher {
12
12
  allServers() {
13
13
  return [this.faasServer, ...this.uiServers];
14
14
  }
15
- async compileAndWatch({ onChange: { onBuildWillStart, onBuildFinished } }, tunnelOptions = cli_shared_1.defaultNoDebugTunnelOptions) {
16
- const [faasResult] = await Promise.all(this.allServers().map((server) => server.compileAndWatch({
17
- onBuildWillStart,
18
- onBuildFinished
19
- }, tunnelOptions)));
15
+ async compileAndWatch({ onRuntimeChange, onUIChange }, tunnelOptions = cli_shared_1.defaultNoDebugTunnelOptions) {
16
+ const [faasResult] = await Promise.all([
17
+ this.faasServer.compileAndWatch(onRuntimeChange, tunnelOptions),
18
+ ...this.uiServers.map((server) => server.compileAndWatch(onUIChange, tunnelOptions))
19
+ ]);
20
20
  return faasResult;
21
21
  }
22
22
  async stop() {
@@ -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,EAAyC,MAAM,EAAQ,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE/C,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,EACzC,mBAAmB,EAAE,SAAS,GAC7B,OAAO,CAAC,IAAI,CAAC;IAsCT,6BAA6B,CAAC,gBAAgB,EAAE,MAAM;IAUtD,QAAQ,sBACM,iBAAiB,kBACrB,aAAa,KAC3B,QAAQ,cAAc,GAAG,SAAS,CAAC,CA8DpC;CACH"}
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,EAAyC,MAAM,EAAQ,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE/C,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,EACzC,mBAAmB,EAAE,SAAS,GAC7B,OAAO,CAAC,IAAI,CAAC;IAsCT,6BAA6B,CAAC,gBAAgB,EAAE,MAAM;IAUtD,QAAQ,sBACM,iBAAiB,kBACrB,aAAa,KAC3B,QAAQ,cAAc,GAAG,SAAS,CAAC,CAwDpC;CACH"}
@@ -59,23 +59,18 @@ class TunnelInteractor {
59
59
  if (inspectorAddress) {
60
60
  this.logger.info(cli_shared_1.Text.tunnel.startedInspector(inspectorAddress));
61
61
  }
62
- const onBundlingStart = async () => {
63
- try {
64
- this.logger.info('');
65
- this.logger.info(cli_shared_1.Text.bundle.detectedChanges);
66
- await (0, bundler_1.runLinter)();
67
- this.logger.info(cli_shared_1.Text.tunnel.preBundleTask(cli_shared_1.Text.tunnel.bundlingHeader));
68
- }
69
- catch (err) {
70
- throw err;
71
- }
62
+ const onBuildWillStart = async () => {
63
+ this.logger.info('');
64
+ this.logger.info(cli_shared_1.Text.bundle.detectedChanges);
65
+ await (0, bundler_1.runLinter)();
66
+ this.logger.info(cli_shared_1.Text.tunnel.preBundleTask(cli_shared_1.Text.tunnel.bundlingHeader));
72
67
  };
73
- const onBundlingFinish = async (err, output) => {
68
+ const onBuildFinished = (kind) => async (err, output) => {
74
69
  if (err) {
75
70
  this.logger.error(err);
76
71
  return;
77
72
  }
78
- if (output) {
73
+ if (kind === 'runtime') {
79
74
  await reloadSandboxes(output, tunnelOptions);
80
75
  }
81
76
  this.logger.info('');
@@ -86,10 +81,8 @@ class TunnelInteractor {
86
81
  this.logger.info(cli_shared_1.Text.tunnel.preBundleTask(cli_shared_1.Text.tunnel.bundlingHeader));
87
82
  try {
88
83
  const output = await multiCompiler.compileAndWatch({
89
- onChange: {
90
- onBuildWillStart: onBundlingStart,
91
- onBuildFinished: onBundlingFinish
92
- }
84
+ onRuntimeChange: { onBuildWillStart, onBuildFinished: onBuildFinished('runtime') },
85
+ onUIChange: { onBuildWillStart, onBuildFinished: onBuildFinished('ui') }
93
86
  }, tunnelOptions);
94
87
  await reloadSandboxes(output, tunnelOptions);
95
88
  this.logger.info('');
@@ -3,18 +3,14 @@
3
3
  import http from 'http';
4
4
  import { URL } from 'url';
5
5
  import express from 'express';
6
+ import { BundlerWatch, BundlerOutput } from '@forge/bundler';
6
7
  import { ConfigFile, FileSystemReader, Logger, StatsigService, TunnelOptions } from '@forge/cli-shared';
7
8
  import { ExternalRequestBody } from '@forge/runtime';
8
9
  import { Permissions, Remotes } from '@forge/manifest';
9
- import { BundlerOutput } from '@forge/bundler';
10
- export interface WatchHooks<T = any> {
11
- onBuildWillStart: () => Promise<void>;
12
- onBuildFinished: (err: Error | null, result?: T) => Promise<void>;
13
- }
14
10
  export interface DevelopmentServer {
15
11
  start(port?: number, permissions?: Permissions, remotes?: Remotes): Promise<StartDevServerResult>;
16
12
  stop(): Promise<void>;
17
- compileAndWatch(hooks: WatchHooks<BundlerOutput>, tunnelOptions?: TunnelOptions): Promise<BundlerOutput>;
13
+ compileAndWatch(hooks: BundlerWatch, tunnelOptions?: TunnelOptions): Promise<BundlerOutput>;
18
14
  }
19
15
  export interface StartDevServerResult {
20
16
  port: number;
@@ -39,7 +35,7 @@ export declare class LocalDevelopmentServer implements DevelopmentServer {
39
35
  constructor(invocationService: InvocationService, logger: Logger, configFile: ConfigFile, fileSystemReader: FileSystemReader, statsigService: StatsigService);
40
36
  start(port?: number, permissions?: Permissions, remotes?: Remotes): Promise<StartDevServerResult>;
41
37
  stop(): Promise<void>;
42
- compileAndWatch({ onBuildWillStart, onBuildFinished }: WatchHooks<BundlerOutput>, tunnelOptions?: TunnelOptions): Promise<BundlerOutput>;
38
+ compileAndWatch(watch: BundlerWatch, tunnelOptions?: TunnelOptions): Promise<BundlerOutput>;
43
39
  getApp(): express.Application;
44
40
  handleInvocation: express.Handler;
45
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/servers/dev-server.ts"],"names":[],"mappings":";;AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,OAAO,EACL,UAAU,EAEV,gBAAgB,EAEhB,MAAM,EAEN,cAAc,EAId,aAAa,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAe,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EACL,aAAa,EAKd,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,GAAG;IACjC,gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,eAAe,EAAE,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnE;AACD,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAClG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,eAAe,CAAC,KAAK,EAAE,UAAU,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC1G;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC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C,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAVjC,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,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc;IAQpC,KAAK,CAAC,IAAI,SAAI,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAe5F,IAAI;IAIJ,eAAe,CAC1B,KAAK,EAAE,YAAY,EACnB,aAAa,GAAE,aAA2C,GACzD,OAAO,CAAC,aAAa,CAAC;IA6BlB,MAAM,IAAI,OAAO,CAAC,WAAW;IAI7B,gBAAgB,EAAE,OAAO,CAAC,OAAO,CA2CtC;CACH"}
@@ -7,7 +7,6 @@ const express_1 = tslib_1.__importDefault(require("express"));
7
7
  const bundler_1 = require("@forge/bundler");
8
8
  const cli_shared_1 = require("@forge/cli-shared");
9
9
  const runtime_1 = require("@forge/runtime");
10
- const bundler_2 = require("@forge/bundler");
11
10
  const util_1 = require("../util");
12
11
  async function stopServer(server) {
13
12
  if (!server) {
@@ -53,7 +52,7 @@ class LocalDevelopmentServer {
53
52
  async stop() {
54
53
  await stopServer(this.httpServer);
55
54
  }
56
- async compileAndWatch({ onBuildWillStart, onBuildFinished }, tunnelOptions = cli_shared_1.defaultNoDebugTunnelOptions) {
55
+ async compileAndWatch(watch, tunnelOptions = cli_shared_1.defaultNoDebugTunnelOptions) {
57
56
  const isNodeJsRuntime = (await this.configFile.runtimeType()) === cli_shared_1.RuntimeType.nodejs;
58
57
  const outputDir = isNodeJsRuntime && tunnelOptions.debug ? path_1.default.resolve(cli_shared_1.TUNNEL_BUNDLE_DIRECTORY) : (0, cli_shared_1.tmpDir)('tunnel');
59
58
  const handlers = await this.configFile.getAppHandlers();
@@ -61,41 +60,16 @@ class LocalDevelopmentServer {
61
60
  if (!entryPoints.length) {
62
61
  return { outputDir };
63
62
  }
64
- const getConfig = isNodeJsRuntime
65
- ? (0, bundler_2.getNodeRuntimeBuildConfig)((0, bundler_1.getWrapperProvider)({ fileSystemReader: this.fileSystemReader, statsigService: this.statsigService }))
66
- : bundler_2.getSandboxedRuntimeBuildConfig;
67
- const config = getConfig(entryPoints, {
68
- isWatchMode: true,
69
- isDebugMode: tunnelOptions.debug,
63
+ const bundler = isNodeJsRuntime
64
+ ? new bundler_1.NodeBundler(this.logger, (0, bundler_1.getWrapperProvider)({ fileSystemReader: this.fileSystemReader, statsigService: this.statsigService }))
65
+ : new bundler_1.SandboxBundler(this.logger);
66
+ const { result } = await bundler.watch({
70
67
  appDirectory: process.cwd(),
71
- outputDir
72
- });
73
- const compiler = (0, bundler_2.getCompiler)(config);
74
- let isFirstRun = true;
75
- compiler.hooks.watchRun.tapAsync('watchRun', async (_, watchRunCallback) => {
76
- if (!isFirstRun) {
77
- await onBuildWillStart();
78
- }
79
- watchRunCallback();
80
- });
81
- return new Promise((resolve, reject) => {
82
- compiler.watch({ poll: 1000 }, async (compilerError, stats) => {
83
- try {
84
- (0, bundler_2.handleWebpackCompilationResult)(this.logger, compilerError, stats);
85
- this.logger.info(cli_shared_1.LogColor.trace(cli_shared_1.Text.tunnel.functionsBundlingSucceeded));
86
- if (!isFirstRun) {
87
- await onBuildFinished(null, { outputDir });
88
- }
89
- isFirstRun = false;
90
- resolve({ outputDir });
91
- }
92
- catch (err) {
93
- await onBuildFinished(err);
94
- isFirstRun = false;
95
- reject(err);
96
- }
97
- });
98
- });
68
+ entryPoints,
69
+ watchMode: tunnelOptions.debug ? 'debug' : 'watch',
70
+ successMessage: cli_shared_1.Text.tunnel.functionsBundlingSucceeded
71
+ }, watch);
72
+ return result;
99
73
  }
100
74
  getApp() {
101
75
  return this.app;
@@ -1,14 +1,14 @@
1
1
  import WebpackDevServer from 'webpack-dev-server';
2
- import { BundlerOutput } from '@forge/bundler';
2
+ import { BundlerOutput, BundlerWatch } from '@forge/bundler';
3
3
  import { ResourceTunnelServer, ResourceTunnelServerArgs } from './resource-tunnel-server';
4
- import { DevelopmentServer, StartDevServerResult, WatchHooks } from './dev-server';
4
+ import { DevelopmentServer, StartDevServerResult } from './dev-server';
5
5
  export declare class NativeUITunnelServer extends ResourceTunnelServer implements DevelopmentServer {
6
6
  private readonly tunnelArgs;
7
7
  readonly server: WebpackDevServer;
8
8
  private readonly outputDir;
9
9
  constructor(tunnelArgs: ResourceTunnelServerArgs);
10
10
  start(): Promise<Required<StartDevServerResult>>;
11
- compileAndWatch({ onBuildWillStart, onBuildFinished }: WatchHooks): Promise<BundlerOutput>;
11
+ compileAndWatch({ onBuildWillStart, onBuildFinished }: BundlerWatch): Promise<BundlerOutput>;
12
12
  stop(): Promise<void>;
13
13
  }
14
14
  //# sourceMappingURL=native-ui-tunnel-server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"native-ui-tunnel-server.d.ts","sourceRoot":"","sources":["../../src/servers/native-ui-tunnel-server.ts"],"names":[],"mappings":"AAAA,OAAO,gBAA+D,MAAM,oBAAoB,CAAC;AACjG,OAAO,EAAE,aAAa,EAAuE,MAAM,gBAAgB,CAAC;AACpH,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAG1F,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEnF,qBAAa,oBAAqB,SAAQ,oBAAqB,YAAW,iBAAiB;IAI7E,OAAO,CAAC,QAAQ,CAAC,UAAU;IAHvC,SAAgB,MAAM,EAAE,gBAAgB,CAAC;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEN,UAAU,EAAE,wBAAwB;IA4D3D,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;IAWzC,eAAe,CAAC,EAAE,gBAAgB,EAAE,eAAe,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;IAsCjG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5B"}
1
+ {"version":3,"file":"native-ui-tunnel-server.d.ts","sourceRoot":"","sources":["../../src/servers/native-ui-tunnel-server.ts"],"names":[],"mappings":"AAAA,OAAO,gBAA+D,MAAM,oBAAoB,CAAC;AACjG,OAAO,EACL,aAAa,EAIb,YAAY,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAG1F,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEvE,qBAAa,oBAAqB,SAAQ,oBAAqB,YAAW,iBAAiB;IAI7E,OAAO,CAAC,QAAQ,CAAC,UAAU;IAHvC,SAAgB,MAAM,EAAE,gBAAgB,CAAC;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEN,UAAU,EAAE,wBAAwB;IA4D3D,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;IAWzC,eAAe,CAAC,EAAE,gBAAgB,EAAE,eAAe,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAqCnG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5B"}
@@ -75,17 +75,17 @@ class NativeUITunnelServer extends resource_tunnel_server_1.ResourceTunnelServer
75
75
  let isFirstCompilation = true;
76
76
  return new Promise((resolve, reject) => {
77
77
  compiler.hooks.done.tapAsync('done', async (stats, doneCallback) => {
78
- const maybeError = stats.hasErrors() ? stats.compilation.getErrors()[0] : undefined;
79
78
  try {
80
- (0, bundler_1.handleWebpackCompilationResult)(this.logger, maybeError, stats);
79
+ (0, bundler_1.handleWebpackCompilationResult)(this.logger, null, stats);
81
80
  this.logger.info(cli_shared_1.LogColor.trace(cli_shared_1.Text.tunnel.resourcesBundlingSucceeded));
81
+ const result = { outputDir: this.outputDir };
82
82
  if (!isFirstCompilation) {
83
- await onBuildFinished(null);
83
+ await onBuildFinished(null, result);
84
84
  }
85
85
  else {
86
86
  isFirstCompilation = false;
87
87
  }
88
- resolve({ outputDir: this.outputDir });
88
+ resolve(result);
89
89
  }
90
90
  catch (err) {
91
91
  await onBuildFinished(err);
@@ -1 +1 @@
1
- {"version":3,"file":"create-tunnel-service.d.ts","sourceRoot":"","sources":["../../src/services/create-tunnel-service.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAE5D,oBAAY,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACtC,CAAC;AAEF,oBAAY,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,sBAAsB,CAAC;AAE3B,MAAM,WAAW,mBAAmB;IAClC,eAAe,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5E,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,qBAAa,eAAgB,SAAQ,SAAS;CAAG;AAEjD,qBAAa,6BAA8B,YAAW,mBAAmB;IAG3D,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,O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AI,CAAC;CAQ1C"}
@@ -24,7 +24,19 @@ class CloudflareCreateTunnelService {
24
24
  '--protocol': 'http2'
25
25
  };
26
26
  options[id] = null;
27
- const { connections, stop } = (0, cloudflared_1.tunnel)(options);
27
+ process.env['TUNNEL_LOGLEVEL'] = 'debug';
28
+ const { connections, stop, child } = (0, cloudflared_1.tunnel)(options);
29
+ child.stdout?.on('data', (chunk) => this.logger.debug(cli_shared_1.Text.tunnel.cloudflaredLog(chunk)));
30
+ child.stderr?.on('data', (chunk) => this.logger.debug(cli_shared_1.Text.tunnel.cloudflaredLog(chunk)));
31
+ child.on('error', (err) => {
32
+ this.logger.error(err);
33
+ throw new cli_shared_1.BaseError(cli_shared_1.Text.tunnel.error.cloudflaredError);
34
+ });
35
+ child.on('exit', (code) => {
36
+ if (code !== 0) {
37
+ throw new cli_shared_1.BaseError(cli_shared_1.Text.tunnel.error.cloudflaredExit(code));
38
+ }
39
+ });
28
40
  await Promise.all(connections);
29
41
  this.stopFunction = stop;
30
42
  this.logger.debug(cli_shared_1.Text.tunnel.startedTunnel(tunnelUrl));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/tunnel",
3
- "version": "5.6.1-next.0",
3
+ "version": "5.7.0-next.10",
4
4
  "description": "Tunnel functionality for Forge CLI",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
@@ -11,9 +11,9 @@
11
11
  "compile": "tsc -b -v"
12
12
  },
13
13
  "dependencies": {
14
- "@forge/bundler": "4.20.1-next.0",
15
- "@forge/cli-shared": "6.3.1-next.0",
16
- "@forge/csp": "3.3.0",
14
+ "@forge/bundler": "4.20.1-next.9",
15
+ "@forge/cli-shared": "6.4.0-next.8",
16
+ "@forge/csp": "3.4.0-next.0",
17
17
  "@forge/runtime": "5.10.3",
18
18
  "chokidar": "^3.6.0",
19
19
  "cloudflared": "^0.5.2",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@atlassian/xen-test-util": "^4.2.0",
32
- "@forge/manifest": "8.0.1-next.0",
32
+ "@forge/manifest": "8.1.0-next.6",
33
33
  "@types/express": "^4.17.21",
34
34
  "@types/jest": "^29.5.12",
35
35
  "@types/node": "14.18.63",