@forge/tunnel 7.1.0-next.0-experimental-620648d → 7.1.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,18 +1,84 @@
1
1
  # @forge/tunnel
2
2
 
3
- ## 7.1.0-next.0-experimental-620648d
3
+ ## 7.1.0-next.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [bc2d278]
8
+ - @forge/cli-shared@9.3.0-next.10
9
+ - @forge/bundler@7.1.0-next.10
10
+
11
+ ## 7.1.0-next.9
4
12
 
5
13
  ### Minor Changes
6
14
 
7
- - d706cd8: Add support for manually bundling UI Kit resources and bypassing the built-in default bundler
15
+ - a36d70b: Implement manual bundler
8
16
 
9
17
  ### Patch Changes
10
18
 
11
- - Updated dependencies [5c2457b]
12
- - Updated dependencies [ca4fa27]
13
- - @forge/cli-shared@9.3.0-next.0-experimental-620648d
14
- - @forge/bundler@7.0.3-next.0-experimental-620648d
15
- - @forge/csp@6.2.0-experimental-620648d
19
+ - Updated dependencies [a36d70b]
20
+ - @forge/bundler@7.1.0-next.9
21
+ - @forge/cli-shared@9.3.0-next.9
22
+
23
+ ## 7.1.0-next.8
24
+
25
+ ### Patch Changes
26
+
27
+ - @forge/bundler@7.1.0-next.8
28
+ - @forge/cli-shared@9.3.0-next.8
29
+
30
+ ## 7.1.0-next.7
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [e7bfe5e]
35
+ - @forge/cli-shared@9.3.0-next.7
36
+ - @forge/bundler@7.1.0-next.7
37
+
38
+ ## 7.1.0-next.6
39
+
40
+ ### Patch Changes
41
+
42
+ - Updated dependencies [0949833]
43
+ - @forge/cli-shared@9.3.0-next.6
44
+ - @forge/bundler@7.1.0-next.6
45
+
46
+ ## 7.1.0-next.5
47
+
48
+ ### Patch Changes
49
+
50
+ - Updated dependencies [d1610cc]
51
+ - @forge/bundler@7.1.0-next.5
52
+ - @forge/cli-shared@9.3.0-next.5
53
+
54
+ ## 7.1.0-next.4
55
+
56
+ ### Patch Changes
57
+
58
+ - @forge/bundler@7.0.3-next.4
59
+ - @forge/cli-shared@9.3.0-next.4
60
+
61
+ ## 7.1.0-next.3
62
+
63
+ ### Patch Changes
64
+
65
+ - @forge/bundler@7.0.3-next.3
66
+ - @forge/cli-shared@9.3.0-next.3
67
+
68
+ ## 7.1.0-next.2
69
+
70
+ ### Patch Changes
71
+
72
+ - @forge/bundler@7.0.3-next.2
73
+ - @forge/cli-shared@9.3.0-next.2
74
+
75
+ ## 7.1.0-next.1
76
+
77
+ ### Patch Changes
78
+
79
+ - Updated dependencies [4d50a76]
80
+ - @forge/cli-shared@9.3.0-next.1
81
+ - @forge/bundler@7.0.3-next.1
16
82
 
17
83
  ## 7.1.0-next.0
18
84
 
@@ -10,9 +10,10 @@ export declare class LocalFunctionHost implements FunctionChangeWatcher {
10
10
  private readonly configFile;
11
11
  private readonly logger;
12
12
  private readonly createSandbox;
13
+ private currentSandboxPath;
13
14
  private currentTunnelOptions;
14
15
  constructor(configFile: ConfigFile, logger: Logger, createSandbox: (cfg: SandboxConfig) => Promise<Sandbox>);
15
- startWatching(bundledCode: BundlerOutput, tunnelOptions?: TunnelOptions): Promise<void>;
16
+ startWatching(bundledCode: BundlerOutput, tunnelOptions: TunnelOptions): Promise<void>;
16
17
  stopWatching(): Promise<void>;
17
18
  private onRuntimeLog;
18
19
  private runAssistantErrorAnalysis;
@@ -1 +1 @@
1
- {"version":3,"file":"function-change-watcher.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/function-change-watcher.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EAEV,MAAM,EACN,aAAa,EAId,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAIL,OAAO,EACP,aAAa,EAEd,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,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,aAAa;IALhC,OAAO,CAAC,oBAAoB,CAA8C;gBAGvD,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC;IAG7D,aAAa,CACxB,WAAW,EAAE,aAAa,EAC1B,aAAa,GAAE,aAA2C,GACzD,OAAO,CAAC,IAAI,CAAC;IAeH,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,OAAO,CAAC,YAAY,CAOlB;IAEF,OAAO,CAAC,yBAAyB,CAa/B;YAEY,mBAAmB;WAwBnB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa;CAY7F"}
1
+ {"version":3,"file":"function-change-watcher.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/function-change-watcher.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EAGV,MAAM,EACN,aAAa,EAId,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAgB,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAIL,OAAO,EACP,aAAa,EAEd,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,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC,qBAAa,iBAAkB,YAAW,qBAAqB;IAK3D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,aAAa;IANhC,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,oBAAoB,CAA4B;gBAGrC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC;IAG7D,aAAa,CAAC,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BtF,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,OAAO,CAAC,YAAY,CAOlB;IAEF,OAAO,CAAC,yBAAyB,CAa/B;YAEY,mBAAmB;WA8BnB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa;CAY7F"}
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LocalFunctionHost = exports.MEMORY_LIMIT = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const path_1 = tslib_1.__importDefault(require("path"));
6
- const promises_1 = require("fs/promises");
7
6
  const cli_shared_1 = require("@forge/cli-shared");
7
+ const bundler_1 = require("@forge/bundler");
8
8
  const runtime_1 = require("@forge/runtime");
9
9
  const util_1 = require("../../util");
10
10
  exports.MEMORY_LIMIT = 256;
@@ -12,19 +12,27 @@ class LocalFunctionHost {
12
12
  configFile;
13
13
  logger;
14
14
  createSandbox;
15
- currentTunnelOptions = cli_shared_1.defaultNoDebugTunnelOptions;
15
+ currentSandboxPath;
16
+ currentTunnelOptions;
16
17
  constructor(configFile, logger, createSandbox) {
17
18
  this.configFile = configFile;
18
19
  this.logger = logger;
19
20
  this.createSandbox = createSandbox;
20
21
  }
21
- async startWatching(bundledCode, tunnelOptions = cli_shared_1.defaultNoDebugTunnelOptions) {
22
+ async startWatching(bundledCode, tunnelOptions) {
22
23
  this.currentTunnelOptions = tunnelOptions;
23
- const pathTo = (relativePath) => path_1.default.resolve(bundledCode.outputDir, relativePath);
24
- const manifestFilePath = pathTo(cli_shared_1.manifestFileName);
25
24
  const manifestContents = JSON.stringify(await this.configFile.readConfig());
26
- await (0, promises_1.writeFile)(manifestFilePath, manifestContents);
27
- await this.initializeSandboxes(bundledCode.outputDir, tunnelOptions);
25
+ let additionalOutputs = (0, bundler_1.mergeOutputs)(bundledCode.additionalOutputs, new Map([[cli_shared_1.manifestFileName, Buffer.from(manifestContents)]]));
26
+ this.currentSandboxPath = path_1.default.resolve(cli_shared_1.TUNNEL_BUNDLE_DIRECTORY);
27
+ if (path_1.default.resolve(bundledCode.outputDir) !== this.currentSandboxPath) {
28
+ additionalOutputs = (0, bundler_1.mergeOutputs)(additionalOutputs, new Map([['', bundledCode.outputDir]]));
29
+ }
30
+ if (additionalOutputs.size > 0) {
31
+ const archiver = new cli_shared_1.DirectoryArchiver(this.currentSandboxPath);
32
+ archiver.addMany(additionalOutputs);
33
+ await archiver.finalise();
34
+ }
35
+ await this.initializeSandboxes();
28
36
  runtime_1.StaticInvocationEventEmitter.addListener(runtime_1.EVENT_P3_LOG, this.onRuntimeLog);
29
37
  }
30
38
  async stopWatching() {
@@ -37,7 +45,7 @@ class LocalFunctionHost {
37
45
  }
38
46
  };
39
47
  runAssistantErrorAnalysis = (event) => {
40
- const assistantName = this.currentTunnelOptions.assistantName;
48
+ const assistantName = this.currentTunnelOptions?.assistantName;
41
49
  if (assistantName) {
42
50
  const errorMessage = JSON.stringify(event);
43
51
  const prompt = (0, cli_shared_1.createForgeTunnelErrorPrompt)(errorMessage);
@@ -46,7 +54,12 @@ class LocalFunctionHost {
46
54
  });
47
55
  }
48
56
  };
49
- async initializeSandboxes(srcPath, tunnelOptions) {
57
+ async initializeSandboxes() {
58
+ const sandboxPath = this.currentSandboxPath;
59
+ const tunnelOptions = this.currentTunnelOptions;
60
+ if (!sandboxPath || !tunnelOptions) {
61
+ return;
62
+ }
50
63
  try {
51
64
  util_1.SandboxesContainer.stopSandboxes();
52
65
  const handlers = await this.configFile.getAppHandlers();
@@ -54,7 +67,7 @@ class LocalFunctionHost {
54
67
  await Promise.all(handlers.map(async ({ module, func }) => {
55
68
  sandboxes[`${module}.${func}`] = await this.createSandbox({
56
69
  modName: module,
57
- appPath: srcPath,
70
+ appPath: sandboxPath,
58
71
  handler: func,
59
72
  debugPort: LocalFunctionHost.getDebuggerPort(module, func, tunnelOptions),
60
73
  debugHost: tunnelOptions.debugHost
@@ -2,7 +2,7 @@ import { WatcherMonitor } from '@forge/bundler';
2
2
  import { Logger, TunnelOptions, StatsigService } from '@forge/cli-shared';
3
3
  import { ChildProcess } from 'child_process';
4
4
  import { StartTunnelResult } from '../start-tunnel-command';
5
- import chokidar, { FSWatcher } from 'chokidar';
5
+ import { FSWatcher } from 'chokidar';
6
6
  export interface DockerAuthenticator {
7
7
  authenticateDocker(): Promise<ChildProcess>;
8
8
  }
@@ -13,7 +13,7 @@ export declare class TunnelInteractor {
13
13
  constructor(logger: Logger, statsigService: StatsigService, dockerAuthenticator: DockerAuthenticator);
14
14
  private logTunnelStatus;
15
15
  handleUserExitEvent(stopFunction: () => Promise<void>, bundleMonitor: WatcherMonitor | undefined, manifestFileWatcher: FSWatcher): Promise<void>;
16
- watchAndWarnOnManifestChanges(manifestFilePath: string): chokidar.FSWatcher;
16
+ watchAndWarnOnManifestChanges(manifestFilePath: string): FSWatcher;
17
17
  watchApp: (startTunnelResult: StartTunnelResult, tunnelOptions?: TunnelOptions) => Promise<WatcherMonitor | undefined>;
18
18
  }
19
19
  //# 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,EAGL,MAAM,EAEN,aAAa,EACb,cAAc,EAIf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;CAC7C;AAED,qBAAa,gBAAgB;IAGzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IAJtC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;gBAE7B,MAAM,EAAE,MAAM,EAC/B,cAAc,EAAE,cAAc,EACb,mBAAmB,EAAE,mBAAmB;IAK3D,OAAO,CAAC,eAAe;IAShB,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,GACb,mBAAmB,iBAAiB,EACpC,gBAAe,aAA2C,KACzD,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAwFpC;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,EAGL,MAAM,EAEN,aAAa,EACb,cAAc,EAIf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAiB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;CAC7C;AAED,qBAAa,gBAAgB;IAGzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IAJtC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;gBAE7B,MAAM,EAAE,MAAM,EAC/B,cAAc,EAAE,cAAc,EACb,mBAAmB,EAAE,mBAAmB;IAK3D,OAAO,CAAC,eAAe;IAShB,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,GACb,mBAAmB,iBAAiB,EACpC,gBAAe,aAA2C,KACzD,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAwFpC;CACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/tunnel",
3
- "version": "7.1.0-next.0-experimental-620648d",
3
+ "version": "7.1.0-next.10",
4
4
  "description": "Tunnel functionality for Forge CLI",
5
5
  "author": "Atlassian",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
@@ -11,13 +11,13 @@
11
11
  "compile": "tsc -b -v"
12
12
  },
13
13
  "dependencies": {
14
- "@forge/bundler": "7.0.3-next.0-experimental-620648d",
15
- "@forge/cli-shared": "9.3.0-next.0-experimental-620648d",
16
- "@forge/csp": "6.2.0-experimental-620648d",
14
+ "@forge/bundler": "7.1.0-next.10",
15
+ "@forge/cli-shared": "9.3.0-next.10",
16
+ "@forge/csp": "6.2.0",
17
17
  "@forge/runtime": "7.0.0",
18
18
  "@forge/util": "^3.0.0",
19
19
  "cheerio": "^1.2.0",
20
- "chokidar": "^3.6.0",
20
+ "chokidar": "^4.0.3",
21
21
  "cloudflared": "^0.7.0",
22
22
  "docker-compose": "^1.3.0",
23
23
  "express": "^4.18.3",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@atlassian/xen-test-util": "^4.2.0",
36
- "@forge/manifest": "13.3.0-next.0-experimental-620648d",
36
+ "@forge/manifest": "13.3.0-next.7",
37
37
  "@types/express": "^4.17.21",
38
38
  "@types/jest": "^29.5.14",
39
39
  "@types/node": "20.19.1",