@forge/tunnel 3.3.3-next.0 → 3.3.3-next.2

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,20 @@
1
1
  # @forge/tunnel
2
2
 
3
+ ## 3.3.3-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [e8d41b0]
8
+ - @forge/cli-shared@3.10.1-next.0
9
+ - @forge/bundler@4.6.4-next.2
10
+
11
+ ## 3.3.3-next.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [e91cabc]
16
+ - @forge/bundler@4.6.4-next.1
17
+
3
18
  ## 3.3.3-next.0
4
19
 
5
20
  ### Patch Changes
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- import { MakeDirectoryOptions } from 'fs';
3
1
  import { ConfigFile, FeatureFlagReader, Logger } from '@forge/cli-shared';
4
2
  import { BundlerOutput } from '@forge/bundler';
5
3
  import { Sandbox, SandboxConfig, SnapshotCreator } from '@forge/runtime';
@@ -7,10 +5,6 @@ export interface FunctionChangeWatcher {
7
5
  startWatching(bundledCode: BundlerOutput): Promise<void>;
8
6
  stopWatching(): Promise<void>;
9
7
  }
10
- export interface FsInteractor {
11
- writeFile: (path: string, data: any) => Promise<void>;
12
- mkdir: (path: string, options?: MakeDirectoryOptions) => Promise<void>;
13
- }
14
8
  export interface Bundle {
15
9
  bundleFilePath: string;
16
10
  bundleFileContent: string;
@@ -24,10 +18,9 @@ export declare class LocalFunctionHost implements FunctionChangeWatcher {
24
18
  private readonly logger;
25
19
  private readonly snapshot;
26
20
  private readonly createSandbox;
27
- private readonly fsInteractor;
28
21
  private readonly featureFlags;
29
22
  private snapshotLogs;
30
- constructor(configFile: ConfigFile, logger: Logger, snapshot: SnapshotCreator | null, createSandbox: (cfg: SandboxConfig) => Promise<Sandbox>, fsInteractor: FsInteractor, featureFlags: FeatureFlagReader);
23
+ constructor(configFile: ConfigFile, logger: Logger, snapshot: SnapshotCreator | null, createSandbox: (cfg: SandboxConfig) => Promise<Sandbox>, featureFlags: FeatureFlagReader);
31
24
  private generateBundleFiles;
32
25
  startWatching(bundledCode: BundlerOutput): Promise<void>;
33
26
  stopWatching(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"function-change-watcher.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/function-change-watcher.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAG1C,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAA8B,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAC5G,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,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE;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,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC,qBAAa,iBAAkB,YAAW,qBAAqB;IAI3D,OAAO,CAAC,QAAQ,CAAC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;CAC9B;AAED,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,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;IAC9B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAP/B,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,EACvD,YAAY,EAAE,iBAAiB;YAGpC,mBAAmB;IA2BpB,aAAa,CAAC,WAAW,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IA8CxD,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,OAAO,CAAC,YAAY,CAElB;YAEY,mBAAmB;CAsBlC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LocalFunctionHost = exports.MEMORY_LIMIT = exports.INVOCATION_TIMEOUT = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const path_1 = require("path");
6
+ const fs_1 = require("fs");
6
7
  const tmp_1 = tslib_1.__importDefault(require("tmp"));
7
8
  const cli_shared_1 = require("@forge/cli-shared");
8
9
  const runtime_1 = require("@forge/runtime");
@@ -10,12 +11,11 @@ const util_1 = require("../../util");
10
11
  exports.INVOCATION_TIMEOUT = 10;
11
12
  exports.MEMORY_LIMIT = 256;
12
13
  class LocalFunctionHost {
13
- constructor(configFile, logger, snapshot, createSandbox, fsInteractor, featureFlags) {
14
+ constructor(configFile, logger, snapshot, createSandbox, featureFlags) {
14
15
  this.configFile = configFile;
15
16
  this.logger = logger;
16
17
  this.snapshot = snapshot;
17
18
  this.createSandbox = createSandbox;
18
- this.fsInteractor = fsInteractor;
19
19
  this.featureFlags = featureFlags;
20
20
  this.snapshotLogs = [];
21
21
  this.onRuntimeLog = (event) => {
@@ -23,22 +23,22 @@ class LocalFunctionHost {
23
23
  };
24
24
  }
25
25
  async generateBundleFiles(bundle, withSnapshot) {
26
- await this.fsInteractor.mkdir((0, path_1.dirname)(bundle.bundleFilePath), { recursive: true });
26
+ await fs_1.promises.mkdir((0, path_1.dirname)(bundle.bundleFilePath), { recursive: true });
27
27
  if (withSnapshot) {
28
28
  if (!this.snapshot) {
29
29
  throw new Error('Snapshot requested but snapshot creator not provided.');
30
30
  }
31
31
  const snapshotOutput = await this.snapshot({ isolateMemory: exports.MEMORY_LIMIT }, Buffer.from(bundle.bundleFileContent), bundle.bundleFilePath, bundle.bundleFileSourceMap ? Buffer.from(bundle.bundleFileSourceMap) : undefined);
32
- await this.fsInteractor.writeFile(bundle.bundleFilePath + '.snapshot', Buffer.from(snapshotOutput.buffer));
32
+ await fs_1.promises.writeFile(bundle.bundleFilePath + '.snapshot', Buffer.from(snapshotOutput.buffer));
33
33
  if (snapshotOutput.logs.length > 0) {
34
34
  this.snapshotLogs.push(snapshotOutput.logs);
35
35
  }
36
36
  }
37
37
  else {
38
- await this.fsInteractor.writeFile(bundle.bundleFilePath, bundle.bundleFileContent);
38
+ await fs_1.promises.writeFile(bundle.bundleFilePath, bundle.bundleFileContent);
39
39
  }
40
40
  if (bundle.bundleFileSourceMap) {
41
- await this.fsInteractor.writeFile(bundle.bundleFileSourceMapPath, bundle.bundleFileSourceMap);
41
+ await fs_1.promises.writeFile(bundle.bundleFileSourceMapPath, bundle.bundleFileSourceMap);
42
42
  }
43
43
  }
44
44
  async startWatching(bundledCode) {
@@ -62,7 +62,7 @@ class LocalFunctionHost {
62
62
  const manifestContents = JSON.stringify(await this.configFile.readConfig());
63
63
  const allPromises = [];
64
64
  bundles.forEach((bundle) => allPromises.push(this.generateBundleFiles(bundle, isSnapshotEnabled)));
65
- allPromises.push(this.fsInteractor.writeFile(manifestFilePath, manifestContents));
65
+ allPromises.push(fs_1.promises.writeFile(manifestFilePath, manifestContents));
66
66
  await Promise.all(allPromises);
67
67
  if (isSnapshotEnabled) {
68
68
  if (this.snapshotLogs.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/tunnel",
3
- "version": "3.3.3-next.0",
3
+ "version": "3.3.3-next.2",
4
4
  "description": "Tunnel functionality for Forge CLI",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
@@ -11,8 +11,8 @@
11
11
  "compile": "tsc -b -v"
12
12
  },
13
13
  "dependencies": {
14
- "@forge/bundler": "4.6.4-next.0",
15
- "@forge/cli-shared": "3.10.0",
14
+ "@forge/bundler": "4.6.4-next.2",
15
+ "@forge/cli-shared": "3.10.1-next.0",
16
16
  "@forge/csp": "2.1.1",
17
17
  "@forge/runtime": "4.3.1",
18
18
  "express": "^4.17.1",
@@ -29,7 +29,7 @@
29
29
  "@forge/manifest": "4.9.1",
30
30
  "@types/express": "^4.17.2",
31
31
  "@types/jest": "^29.1.2",
32
- "@types/node": "^12.12.63",
32
+ "@types/node": "14.18.42",
33
33
  "@types/supertest": "^2.0.12",
34
34
  "@types/tmp": "^0.1.0",
35
35
  "@types/uuid": "^3.4.10",