@forge/tunnel 5.10.0-next.12 → 5.10.0-next.13-experimental-ebf5733

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,36 @@
1
1
  # @forge/tunnel
2
2
 
3
+ ## 5.10.0-next.13-experimental-ebf5733
4
+
5
+ ### Minor Changes
6
+
7
+ - 9471e5d: Package Node runtime in a central location and remove 'bundled'
8
+
9
+ ### Patch Changes
10
+
11
+ - 456e5a9: Fix tunnelling using single wrapper
12
+ - 30f197e: Refactoring to enable alternate bundler support
13
+ - Updated dependencies [70cd30c]
14
+ - Updated dependencies [4879128]
15
+ - Updated dependencies [cf5bc5c]
16
+ - Updated dependencies [272d770]
17
+ - Updated dependencies [9471e5d]
18
+ - Updated dependencies [78a006f]
19
+ - Updated dependencies [30f197e]
20
+ - @forge/cli-shared@6.7.0-next.11-experimental-ebf5733
21
+ - @forge/bundler@4.21.0-next.13-experimental-ebf5733
22
+ - @forge/runtime@5.10.7-next.0-experimental-ebf5733
23
+ - @forge/csp@3.6.2-experimental-ebf5733
24
+
25
+ ## 5.10.0-next.13
26
+
27
+ ### Patch Changes
28
+
29
+ - 456e5a9: Fix tunnelling using single wrapper
30
+ - Updated dependencies [4879128]
31
+ - @forge/cli-shared@6.7.0-next.11
32
+ - @forge/bundler@4.21.0-next.13
33
+
3
34
  ## 5.10.0-next.12
4
35
 
5
36
  ### Patch Changes
@@ -1,9 +1,11 @@
1
1
  import { XenInvocationRequest, LimitsTracker, InvocationResult, Sandbox, SandboxConfig, Inspector } from '@forge/runtime';
2
+ import { StatsigService } from '@forge/cli-shared';
2
3
  export declare class NodeSandbox implements Sandbox {
4
+ private readonly statsigService;
3
5
  readonly name: string;
4
- private readonly process;
6
+ private process;
5
7
  private readonly callbacks;
6
- constructor({ appPath, modName, handler, debugPort }: SandboxConfig);
8
+ constructor({ appPath, modName, handler, debugPort }: SandboxConfig, statsigService: StatsigService);
7
9
  private handleOutput;
8
10
  execute(xenInvocationRequest: XenInvocationRequest, invocationLimits: LimitsTracker, inspector?: Inspector | undefined): Promise<InvocationResult>;
9
11
  stop(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"node-sandbox.d.ts","sourceRoot":"","sources":["../../src/sandbox/node-sandbox.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,SAAS,EAIV,MAAM,gBAAgB,CAAC;AAMxB,qBAAa,WAAY,YAAW,OAAO;IACzC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkD;gBAEhE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,aAAa;IA6BnE,OAAO,CAAC,YAAY;IAOd,OAAO,CACX,oBAAoB,EAAE,oBAAoB,EAC1C,gBAAgB,EAAE,aAAa,EAC/B,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,GAChC,OAAO,CAAC,gBAAgB,CAAC;IA+B5B,IAAI,IAAI,IAAI;CAGb"}
1
+ {"version":3,"file":"node-sandbox.d.ts","sourceRoot":"","sources":["../../src/sandbox/node-sandbox.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,SAAS,EAIV,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAInD,qBAAa,WAAY,YAAW,OAAO;IAOvC,OAAO,CAAC,QAAQ,CAAC,cAAc;IANjC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkD;gBAG1E,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,aAAa,EACtC,cAAc,EAAE,cAAc;IAmDjD,OAAO,CAAC,YAAY;IAOd,OAAO,CACX,oBAAoB,EAAE,oBAAoB,EAC1C,gBAAgB,EAAE,aAAa,EAC/B,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,GAChC,OAAO,CAAC,gBAAgB,CAAC;IA+B5B,IAAI,IAAI,IAAI;CAGb"}
@@ -3,37 +3,56 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NodeSandbox = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const child_process_1 = require("child_process");
6
- const path_1 = require("path");
6
+ const path_1 = tslib_1.__importDefault(require("path"));
7
7
  const readline_1 = tslib_1.__importDefault(require("readline"));
8
8
  const uuid_1 = require("uuid");
9
9
  const runtime_1 = require("@forge/runtime");
10
- const RUNNER = (0, path_1.join)(__dirname, '..', '..', 'out', 'sandbox', 'sandbox-runner.js');
10
+ const RUNNER = path_1.default.join(__dirname, '..', '..', 'out', 'sandbox', 'sandbox-runner.js');
11
11
  class NodeSandbox {
12
+ statsigService;
12
13
  name;
13
14
  process;
14
15
  callbacks;
15
- constructor({ appPath, modName, handler, debugPort }) {
16
- this.name = `${modName}.${handler}`;
17
- const fileName = `${appPath}/${modName}.cjs`;
16
+ constructor({ appPath, modName, handler, debugPort }, statsigService) {
17
+ this.statsigService = statsigService;
18
+ const name = `${modName}.${handler}`;
19
+ this.name = name;
18
20
  this.callbacks = new Map();
19
- this.process = (0, child_process_1.fork)(RUNNER, [fileName, handler], {
20
- stdio: ['ignore', 'pipe', 2, 'ipc'],
21
- env: {
22
- _HANDLER: this.name,
23
- FORGE_EFS_RUNTIME_PATH: appPath,
24
- FORGE_CUSTOM_WRAPPER_FILE_NAME: '__forge_wrapper__.cjs'
25
- },
26
- execArgv: debugPort ? [`--inspect=0.0.0.0:${debugPort}`] : undefined
27
- });
28
- readline_1.default.createInterface(this.process.stdout).on('line', (line) => {
29
- const message = JSON.parse(line);
30
- this.handleOutput(message);
31
- });
32
- this.process.on('message', (message) => {
33
- const requestId = message.requestId;
34
- const result = message.result;
35
- this.callbacks.get(requestId)?.(result);
36
- });
21
+ this.process = (async () => {
22
+ const useSingleWrapper = await this.statsigService.packageSingleWrapper();
23
+ let fileName;
24
+ let handlerName;
25
+ let handlerEnv;
26
+ if (useSingleWrapper) {
27
+ fileName = path_1.default.join(appPath, '__forge__.js');
28
+ handlerName = 'main';
29
+ handlerEnv = '__forge__.main';
30
+ }
31
+ else {
32
+ fileName = path_1.default.join(appPath, `${modName}.cjs`);
33
+ handlerName = handler;
34
+ handlerEnv = `index.${handler}`;
35
+ }
36
+ const process = (0, child_process_1.fork)(RUNNER, [fileName, handlerName], {
37
+ stdio: ['ignore', 'pipe', 2, 'ipc'],
38
+ env: {
39
+ _HANDLER: handlerEnv,
40
+ FORGE_EFS_RUNTIME_PATH: appPath,
41
+ FORGE_CUSTOM_WRAPPER_FILE_NAME: '__forge_wrapper__.cjs'
42
+ },
43
+ execArgv: debugPort ? [`--inspect=0.0.0.0:${debugPort}`] : undefined
44
+ });
45
+ readline_1.default.createInterface(process.stdout).on('line', (line) => {
46
+ const message = JSON.parse(line);
47
+ this.handleOutput(message);
48
+ });
49
+ process.on('message', (message) => {
50
+ const requestId = message.requestId;
51
+ const result = message.result;
52
+ this.callbacks.get(requestId)?.(result);
53
+ });
54
+ return process;
55
+ })();
37
56
  }
38
57
  handleOutput(output) {
39
58
  if (output.invocationId) {
@@ -61,11 +80,11 @@ class NodeSandbox {
61
80
  deadline
62
81
  };
63
82
  const message = { lambdaEvent, tunnelContext };
64
- this.process.send(message);
83
+ void this.process.then((process) => process.send(message));
65
84
  });
66
85
  }
67
86
  stop() {
68
- this.process.kill();
87
+ void this.process.then((process) => process.kill());
69
88
  }
70
89
  }
71
90
  exports.NodeSandbox = NodeSandbox;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/tunnel",
3
- "version": "5.10.0-next.12",
3
+ "version": "5.10.0-next.13-experimental-ebf5733",
4
4
  "description": "Tunnel functionality for Forge CLI",
5
5
  "author": "Atlassian",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
@@ -11,10 +11,10 @@
11
11
  "compile": "tsc -b -v"
12
12
  },
13
13
  "dependencies": {
14
- "@forge/bundler": "4.21.0-next.12",
15
- "@forge/cli-shared": "6.7.0-next.10",
16
- "@forge/csp": "3.6.2",
17
- "@forge/runtime": "5.10.7-next.0",
14
+ "@forge/bundler": "4.21.0-next.13-experimental-ebf5733",
15
+ "@forge/cli-shared": "6.7.0-next.11-experimental-ebf5733",
16
+ "@forge/csp": "3.6.2-experimental-ebf5733",
17
+ "@forge/runtime": "5.10.7-next.0-experimental-ebf5733",
18
18
  "cloudflared": "^0.7.0",
19
19
  "chokidar": "^3.6.0",
20
20
  "express": "^4.18.3",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@atlassian/xen-test-util": "^4.2.0",
33
- "@forge/manifest": "8.8.0-next.5",
33
+ "@forge/manifest": "8.8.0-next.5-experimental-ebf5733",
34
34
  "@types/express": "^4.17.21",
35
35
  "@types/jest": "^29.5.12",
36
36
  "@types/node": "14.18.63",