@forge/tunnel 5.7.0-next.7 → 5.7.0-next.8

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,13 @@
1
1
  # @forge/tunnel
2
2
 
3
+ ## 5.7.0-next.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 34e19bb: Refactor Bundler to support watching
8
+ - Updated dependencies [34e19bb]
9
+ - @forge/bundler@4.20.1-next.7
10
+
3
11
  ## 5.7.0-next.7
4
12
 
5
13
  ### 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,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,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ/E;AAED,qBAAa,sBAAuB,YAAW,iBAAiB;IAO5D,OAAO,CAAC,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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/tunnel",
3
- "version": "5.7.0-next.7",
3
+ "version": "5.7.0-next.8",
4
4
  "description": "Tunnel functionality for Forge CLI",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
@@ -11,7 +11,7 @@
11
11
  "compile": "tsc -b -v"
12
12
  },
13
13
  "dependencies": {
14
- "@forge/bundler": "4.20.1-next.6",
14
+ "@forge/bundler": "4.20.1-next.7",
15
15
  "@forge/cli-shared": "6.4.0-next.6",
16
16
  "@forge/csp": "3.4.0-next.0",
17
17
  "@forge/runtime": "5.10.3",