@forge/bundler 4.10.5-next.9 → 4.11.0

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,158 @@
1
1
  # @forge/bundler
2
2
 
3
+ ## 4.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 63ddf65: Redirected logs through proxy
8
+
9
+ ### Patch Changes
10
+
11
+ - d33c860: Bumping dependencies via Renovate:
12
+
13
+ - @types/react
14
+
15
+ - 1d0c35c: Bumping dependencies via Renovate:
16
+
17
+ - @babel/core
18
+ - @babel/plugin-transform-optional-chaining
19
+ - @babel/traverse
20
+ - @babel/types
21
+
22
+ - 4640d4fb: Bumping dependencies via Renovate:
23
+
24
+ - @types/node
25
+
26
+ - 854ff5d: Fix Authorize API on Node runtime
27
+ - 1e429df: Fix util.inherits
28
+ - 1d3b4b0: Bumping dependencies via Renovate:
29
+
30
+ - @types/react
31
+
32
+ - ac89229: Bumping dependencies via Renovate:
33
+
34
+ - @atlassian/xen-test-util
35
+
36
+ - a777103: Minor refactoring
37
+ - e4a378c: Bumping dependencies via Renovate:
38
+
39
+ - @types/react
40
+ - eslint-plugin-react-hooks
41
+ - react
42
+ - react-dom
43
+ - react-reconciler
44
+
45
+ - Updated dependencies [1d0c35c]
46
+ - Updated dependencies [ea21bdd]
47
+ - Updated dependencies [9e74985]
48
+ - Updated dependencies [388380b]
49
+ - Updated dependencies [a30d4a3]
50
+ - Updated dependencies [1b7fd9a]
51
+ - Updated dependencies [2cba32e]
52
+ - Updated dependencies [4640d4fb]
53
+ - Updated dependencies [854ff5d]
54
+ - Updated dependencies [94ce678]
55
+ - Updated dependencies [f48e6d8]
56
+ - Updated dependencies [bdbea8e1]
57
+ - Updated dependencies [ac89229]
58
+ - Updated dependencies [a777103]
59
+ - @forge/babel-plugin-transform-ui@1.1.6
60
+ - @forge/cli-shared@3.17.1
61
+ - @forge/runtime@4.4.6
62
+ - @forge/api@2.18.4
63
+ - @forge/lint@3.6.4
64
+
65
+ ## 4.11.0-next.19
66
+
67
+ ### Minor Changes
68
+
69
+ - 63ddf65: Redirected logs through proxy
70
+
71
+ ## 4.10.5-next.18
72
+
73
+ ### Patch Changes
74
+
75
+ - d33c860: Bumping dependencies via Renovate:
76
+
77
+ - @types/react
78
+
79
+ ## 4.10.5-next.17
80
+
81
+ ### Patch Changes
82
+
83
+ - 1d3b4b0: Bumping dependencies via Renovate:
84
+
85
+ - @types/react
86
+
87
+ ## 4.10.5-next.16
88
+
89
+ ### Patch Changes
90
+
91
+ - 1d0c35c: Bumping dependencies via Renovate:
92
+
93
+ - @babel/core
94
+ - @babel/plugin-transform-optional-chaining
95
+ - @babel/traverse
96
+ - @babel/types
97
+
98
+ - Updated dependencies [1d0c35c]
99
+ - @forge/babel-plugin-transform-ui@1.1.6-next.0
100
+
101
+ ## 4.10.5-next.15
102
+
103
+ ### Patch Changes
104
+
105
+ - 854ff5d: Fix Authorize API on Node runtime
106
+ - Updated dependencies [854ff5d]
107
+ - @forge/api@2.18.4-next.3
108
+ - @forge/cli-shared@3.17.1-next.11
109
+ - @forge/lint@3.6.4-next.11
110
+
111
+ ## 4.10.5-next.14
112
+
113
+ ### Patch Changes
114
+
115
+ - Updated dependencies [ea21bdd]
116
+ - @forge/cli-shared@3.17.1-next.10
117
+ - @forge/lint@3.6.4-next.10
118
+
119
+ ## 4.10.5-next.13
120
+
121
+ ### Patch Changes
122
+
123
+ - e4a378c: Bumping dependencies via Renovate:
124
+
125
+ - @types/react
126
+ - eslint-plugin-react-hooks
127
+ - react
128
+ - react-dom
129
+ - react-reconciler
130
+
131
+ ## 4.10.5-next.12
132
+
133
+ ### Patch Changes
134
+
135
+ - Updated dependencies [a30d4a3]
136
+ - @forge/cli-shared@3.17.1-next.9
137
+ - @forge/lint@3.6.4-next.9
138
+
139
+ ## 4.10.5-next.11
140
+
141
+ ### Patch Changes
142
+
143
+ - a777103: Minor refactoring
144
+ - Updated dependencies [a777103]
145
+ - @forge/cli-shared@3.17.1-next.8
146
+ - @forge/runtime@4.4.6-next.4
147
+ - @forge/lint@3.6.4-next.8
148
+
149
+ ## 4.10.5-next.10
150
+
151
+ ### Patch Changes
152
+
153
+ - @forge/cli-shared@3.17.1-next.7
154
+ - @forge/lint@3.6.4-next.7
155
+
3
156
  ## 4.10.5-next.9
4
157
 
5
158
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/config/common.ts"],"names":[],"mappings":"AACA,OAAgB,EAAE,aAAa,IAAI,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEjF,OAAO,EAAE,OAAO,EAAoB,MAAM,mBAAmB,CAAC;AAG9D,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG;IAC7C,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,mBAAmB,EAAE,CAiBzE;AAED,eAAO,MAAM,iBAAiB,eAAgB,MAAM,KAAG,MAEtD,CAAC;AAEF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,eAAO,MAAM,gBAAgB,WAAY,aAAa,KAAG,MASxD,CAAC;AAEF,KAAK,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACrE,KAAK,mBAAmB,GAAG,cAAc,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACpD,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,aAAa,EAAE,SAAS,GAAG,QAAQ,CAAC,GACnF,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,GACrC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AAElC,eAAO,MAAM,sBAAsB,gBAAiB,UAAU,EAAE,UAAU,aAAa,KAAG,mBA+FzF,CAAC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/config/common.ts"],"names":[],"mappings":"AACA,OAAgB,EAAE,aAAa,IAAI,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEjF,OAAO,EAAE,OAAO,EAAoB,MAAM,mBAAmB,CAAC;AAG9D,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG;IAC7C,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,mBAAmB,EAAE,CAiBzE;AAED,eAAO,MAAM,iBAAiB,eAAgB,MAAM,KAAG,MAEtD,CAAC;AAEF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,eAAO,MAAM,gBAAgB,WAAY,aAAa,KAAG,MASxD,CAAC;AAEF,KAAK,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACrE,KAAK,mBAAmB,GAAG,cAAc,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACpD,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,aAAa,EAAE,SAAS,GAAG,QAAQ,CAAC,GACnF,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,GACrC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AAElC,eAAO,MAAM,sBAAsB,gBAAiB,UAAU,EAAE,UAAU,aAAa,KAAG,mBAwGzF,CAAC"}
@@ -69,7 +69,11 @@ const getCommonWebpackConfig = (entrypoints, config) => {
69
69
  resolveLoader: {
70
70
  modules: require.resolve.paths('babel-loader') || undefined
71
71
  },
72
- plugins: [new webpack_1.default.IgnorePlugin({ resourceRegExp: /^encoding$/, contextRegExp: /node-fetch/ })],
72
+ plugins: [
73
+ new webpack_1.default.IgnorePlugin({ resourceRegExp: /^encoding$/, contextRegExp: /node-fetch/ }),
74
+ new webpack_1.default.IgnorePlugin({ resourceRegExp: /^(bufferutil|utf-8-validate)$/, contextRegExp: /ws\/lib$/ }),
75
+ new webpack_1.default.IgnorePlugin({ resourceRegExp: /^dtrace-provider$/, contextRegExp: /bunyan$/ })
76
+ ],
73
77
  module: {
74
78
  rules: [
75
79
  {
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/config/node.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EAIpB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,wBAAwB,iBAAiB,CAAC;AAYvD,eAAO,MAAM,yBAAyB,gBACvB,mBAAmB,EAAE,UAC1B,aAAa,KACpB,mBA6DF,CAAC"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/config/node.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EAIpB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,wBAAwB,iBAAiB,CAAC;AAEvD,eAAO,MAAM,yBAAyB,gBACvB,mBAAmB,EAAE,UAC1B,aAAa,KACpB,mBAuDF,CAAC"}
@@ -4,7 +4,6 @@ exports.getNodeRuntimeBuildConfig = exports.NODE_WEBPACK_CONFIG_NAME = void 0;
4
4
  const webpack_1 = require("webpack");
5
5
  const common_1 = require("./common");
6
6
  exports.NODE_WEBPACK_CONFIG_NAME = 'node-runtime';
7
- const IGNORE_MODULES = ['bufferutil', 'utf-8-validate', 'dtrace-provider'];
8
7
  const getNodeRuntimeBuildConfig = (entrypoints, config) => {
9
8
  const webpackConfig = (0, common_1.getCommonWebpackConfig)(entrypoints, config);
10
9
  const wrapperPath = (0, common_1.resolveStubPath)('wrapper');
@@ -15,11 +14,6 @@ const getNodeRuntimeBuildConfig = (entrypoints, config) => {
15
14
  }
16
15
  webpackConfig.entry = newEntries;
17
16
  webpackConfig.target = 'node18';
18
- const ignored = {};
19
- for (const module of IGNORE_MODULES) {
20
- ignored[module] = module;
21
- }
22
- webpackConfig.externals = ignored;
23
17
  const defineExports = ({ filename }) => {
24
18
  const entryName = filename.replace(/\.js$/, '');
25
19
  const entrypoint = entrypoints.find((e) => e.name === entryName);
@@ -1,7 +1,8 @@
1
- import { ConsoleMethod, P3LogEvent, LogHeader, LogFooter, HeadedLogLine } from '@forge/runtime';
1
+ import { ConsoleMethod, P3LogEvent, LogHeader, HeadedLogLine } from '@forge/runtime';
2
2
  export declare function emitTunnelEvent(event: P3LogEvent): void;
3
- export declare function emitLogEvent(event: LogHeader | HeadedLogLine | LogFooter): void;
3
+ export declare function emitLogEvent(event: HeadedLogLine): void;
4
4
  export declare function forgeConsole(consoleMethod: ConsoleMethod, header: LogHeader): (...rawData: unknown[]) => void;
5
5
  export declare function replaceConsole(header: LogHeader): void;
6
6
  export declare function restoreConsole(): void;
7
+ export declare function sendLogCache(): Promise<void>;
7
8
  //# sourceMappingURL=console.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../src/stubs/console.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,aAAa,EACb,UAAU,EAEV,SAAS,EACT,SAAS,EAET,aAAa,EAEd,MAAM,gBAAgB,CAAC;AAQxB,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAEvD;AAOD,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,IAAI,CAE/E;AA6BD,wBAAgB,YAAY,CAAC,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,mCAY3E;AAMD,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,QAI/C;AAED,wBAAgB,cAAc,SAI7B"}
1
+ {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../src/stubs/console.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,aAAa,EACb,UAAU,EAEV,SAAS,EAET,aAAa,EAEd,MAAM,gBAAgB,CAAC;AAWxB,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAEvD;AAOD,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAEvD;AA6BD,wBAAgB,YAAY,CAAC,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,mCAY3E;AAMD,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,QAI/C;AAED,wBAAgB,cAAc,SAI7B;AAED,wBAAsB,YAAY,kBAwCjC"}
@@ -1,15 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.restoreConsole = exports.replaceConsole = exports.forgeConsole = exports.emitLogEvent = exports.emitTunnelEvent = void 0;
3
+ exports.sendLogCache = exports.restoreConsole = exports.replaceConsole = exports.forgeConsole = exports.emitLogEvent = exports.emitTunnelEvent = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const api_1 = require("@forge/api");
5
6
  const runtime_1 = require("@forge/runtime");
6
7
  const util_1 = require("util");
8
+ const https = tslib_1.__importStar(require("https"));
9
+ let logEventCache = [];
7
10
  function emitTunnelEvent(event) {
8
11
  process.stdout.write(JSON.stringify(event) + '\n');
9
12
  }
10
13
  exports.emitTunnelEvent = emitTunnelEvent;
11
14
  function emitLogEvent(event) {
12
- process.stdout.write(JSON.stringify(event) + '\n');
15
+ logEventCache.push(event);
13
16
  }
14
17
  exports.emitLogEvent = emitLogEvent;
15
18
  function customConsole(logLevel, header) {
@@ -54,3 +57,42 @@ function restoreConsole() {
54
57
  }
55
58
  }
56
59
  exports.restoreConsole = restoreConsole;
60
+ async function sendLogCache() {
61
+ var _a;
62
+ const options = {
63
+ method: 'POST',
64
+ protocol: 'https',
65
+ host: 'logs',
66
+ path: '',
67
+ headers: {
68
+ 'Content-Type': 'application/json'
69
+ },
70
+ agent: 'FORGE_PRODUCT_REQUEST'
71
+ };
72
+ if (logEventCache.length > 0) {
73
+ try {
74
+ const req = https.request(options);
75
+ req.write(JSON.stringify(logEventCache));
76
+ const result = await new Promise((resolve, reject) => {
77
+ req.on('response', ({ statusCode, statusMessage }) => resolve({
78
+ statusCode,
79
+ statusMessage
80
+ }));
81
+ req.on('error', reject);
82
+ req.end();
83
+ });
84
+ if (result.statusCode === 200) {
85
+ }
86
+ else {
87
+ process.stderr.write(`Error returned from proxy when sending logs: status code ${result.statusCode}\n`);
88
+ }
89
+ }
90
+ catch (error) {
91
+ process.stderr.write(`Sending logs to proxy ${(_a = error.stack) !== null && _a !== void 0 ? _a : error}\n`);
92
+ }
93
+ finally {
94
+ logEventCache = [];
95
+ }
96
+ }
97
+ }
98
+ exports.sendLogCache = sendLogCache;
@@ -1 +1 @@
1
- {"version":3,"file":"http-node.d.ts","sourceRoot":"","sources":["../../src/stubs/http-node.ts"],"names":[],"mappings":"AAqQA,wBAAgB,YAAY,SAG3B;AAED,wBAAgB,YAAY,SAG3B"}
1
+ {"version":3,"file":"http-node.d.ts","sourceRoot":"","sources":["../../src/stubs/http-node.ts"],"names":[],"mappings":"AAsRA,wBAAgB,YAAY,SAG3B;AAED,wBAAgB,YAAY,SAG3B"}
@@ -43,6 +43,8 @@ function getProxyPath(args) {
43
43
  switch (args.type) {
44
44
  case 'egress':
45
45
  return '/egress';
46
+ case 'logs':
47
+ return '/logs';
46
48
  case 'fpp':
47
49
  return `/fpp/provider/${args.provider}/remote/${args.remote}`;
48
50
  }
@@ -60,6 +62,8 @@ const remoteToMetric = {
60
62
  const METRICS_TAGS = { proxy: 'true' };
61
63
  function getMetricsName(args) {
62
64
  switch (args.type) {
65
+ case 'logs':
66
+ return 'api.log';
63
67
  case 'egress':
64
68
  return 'api.fetch';
65
69
  case 'fpp':
@@ -97,6 +101,9 @@ function request(...args) {
97
101
  }
98
102
  }
99
103
  }
104
+ else if (host === 'logs') {
105
+ proxyArgs = { type: 'logs' };
106
+ }
100
107
  }
101
108
  const { metrics, proxy } = (0, api_1.getRuntime)();
102
109
  const metricsName = getMetricsName(proxyArgs);
@@ -111,6 +118,8 @@ function request(...args) {
111
118
  case 'fpp':
112
119
  headers['forge-proxy-target'] = options.path;
113
120
  break;
121
+ case 'logs':
122
+ break;
114
123
  }
115
124
  const proxyOptions = Object.assign(Object.assign(Object.assign({}, options), (0, url_1.urlToHttpOptions)(new url_1.URL(`${proxy.url}${getProxyPath(proxyArgs)}`))), { headers });
116
125
  metrics.counter(metricsName, METRICS_TAGS).incr();
@@ -2,7 +2,5 @@ import { ExternalRequestBody, LogHeader } from '@forge/runtime';
2
2
  export declare const AWS_EXECUTION_ENV_PREFIX = "AWS_Lambda_";
3
3
  export declare const RUNTIME_NAME_FALLBACK = "node";
4
4
  export declare function getRuntimeName(): string;
5
- export declare function emitHeaderEvent(lambdaEvent: ExternalRequestBody): LogHeader;
6
- export declare function emitSuccessfulFooterEvent(): void;
7
- export declare function emitFailedFooterEvent(): void;
5
+ export declare function invocationHeaderLogs(lambdaEvent: ExternalRequestBody): LogHeader;
8
6
  //# sourceMappingURL=log-events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log-events.d.ts","sourceRoot":"","sources":["../../src/stubs/log-events.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAa,SAAS,EAAW,MAAM,gBAAgB,CAAC;AAIpF,eAAO,MAAM,wBAAwB,gBAAgB,CAAC;AACtD,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAE5C,wBAAgB,cAAc,IAAI,MAAM,CAavC;AAmDD,wBAAgB,eAAe,CAAC,WAAW,EAAE,mBAAmB,GAAG,SAAS,CAI3E;AAED,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD;AAED,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C"}
1
+ {"version":3,"file":"log-events.d.ts","sourceRoot":"","sources":["../../src/stubs/log-events.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAW,MAAM,gBAAgB,CAAC;AAEzE,eAAO,MAAM,wBAAwB,gBAAgB,CAAC;AACtD,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAE5C,wBAAgB,cAAc,IAAI,MAAM,CAavC;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,mBAAmB,GAAG,SAAS,CAiBhF"}
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.emitFailedFooterEvent = exports.emitSuccessfulFooterEvent = exports.emitHeaderEvent = exports.getRuntimeName = exports.RUNTIME_NAME_FALLBACK = exports.AWS_EXECUTION_ENV_PREFIX = void 0;
3
+ exports.invocationHeaderLogs = exports.getRuntimeName = exports.RUNTIME_NAME_FALLBACK = exports.AWS_EXECUTION_ENV_PREFIX = void 0;
4
4
  const api_1 = require("@forge/api");
5
5
  const runtime_1 = require("@forge/runtime");
6
- const console_1 = require("./console");
7
6
  exports.AWS_EXECUTION_ENV_PREFIX = 'AWS_Lambda_';
8
7
  exports.RUNTIME_NAME_FALLBACK = 'node';
9
8
  function getRuntimeName() {
@@ -35,44 +34,4 @@ function invocationHeaderLogs(lambdaEvent) {
35
34
  runtime: getRuntimeName()
36
35
  };
37
36
  }
38
- function invocationFooterLogs(successfulInvocation) {
39
- return {
40
- id: (0, api_1.getRuntime)().lambdaContext.awsRequestId,
41
- type: runtime_1.LogType.FOOTER,
42
- success: successfulInvocation,
43
- logMetadata: {
44
- bytes: 0,
45
- truncated: false,
46
- errorCount: 0
47
- },
48
- outboundCalls: {
49
- count: 0,
50
- stargateCount: 0,
51
- externalCount: 0,
52
- rejectedCount: 0,
53
- bytesOut: 0,
54
- bytesIn: 0,
55
- msWaiting: 0
56
- },
57
- function: {
58
- bytesIn: 0,
59
- bytesOut: 0,
60
- durationMs: 0,
61
- mem: 0
62
- }
63
- };
64
- }
65
- function emitHeaderEvent(lambdaEvent) {
66
- const event = invocationHeaderLogs(lambdaEvent);
67
- (0, console_1.emitLogEvent)(event);
68
- return event;
69
- }
70
- exports.emitHeaderEvent = emitHeaderEvent;
71
- function emitSuccessfulFooterEvent() {
72
- (0, console_1.emitLogEvent)(invocationFooterLogs(true));
73
- }
74
- exports.emitSuccessfulFooterEvent = emitSuccessfulFooterEvent;
75
- function emitFailedFooterEvent() {
76
- (0, console_1.emitLogEvent)(invocationFooterLogs(false));
77
- }
78
- exports.emitFailedFooterEvent = emitFailedFooterEvent;
37
+ exports.invocationHeaderLogs = invocationHeaderLogs;
@@ -23,25 +23,31 @@ const adapter = (name) => {
23
23
  const metricsCollector = new runtime_1.MetricsCollector(new runtime_1.InMemoryMetrics({ runtime: 'nodejs' }));
24
24
  const metrics = metricsCollector.metrics();
25
25
  const rms = lambdaEvent._meta.rms;
26
- const runtime = Object.assign(Object.assign({ proxy: lambdaEvent._meta.proxy, contextAri: lambdaEvent._meta.contextAri, appContext: lambdaEvent._meta.appContext, allowedEgress: (_a = lambdaEvent._meta.fetchAllowList) !== null && _a !== void 0 ? _a : [], lambdaContext: lambdaContext, tracing: lambdaEvent._meta.tracing }, (rms && { rms })), { metrics });
26
+ const runtime = Object.assign(Object.assign({ proxy: lambdaEvent._meta.proxy, contextAri: lambdaEvent._meta.contextAri, appContext: lambdaEvent._meta.appContext, allowedEgress: (_a = lambdaEvent._meta.fetchAllowList) !== null && _a !== void 0 ? _a : [], lambdaContext: lambdaContext, tracing: lambdaEvent._meta.tracing, aaid: lambdaEvent._meta.aaid }, (rms && { rms })), { metrics });
27
27
  global.__forge_runtime__ = runtime;
28
28
  for (const { key, value } of (_b = lambdaEvent.variables) !== null && _b !== void 0 ? _b : []) {
29
29
  process.env[key] = value;
30
30
  }
31
31
  try {
32
- const header = (0, log_events_1.emitHeaderEvent)(lambdaEvent);
32
+ const header = (0, log_events_1.invocationHeaderLogs)(lambdaEvent);
33
33
  (0, console_1.replaceConsole)(header);
34
34
  (0, http_node_1.replaceHttps)();
35
35
  const timer = metrics.timing('invoke').measure();
36
36
  const bundled = realRequire(wrappedFilename);
37
37
  let result;
38
38
  try {
39
- result = await bundled[name](event, context);
39
+ try {
40
+ result = await bundled[name](event, context);
41
+ }
42
+ catch (err) {
43
+ console.error(err);
44
+ throw err;
45
+ }
40
46
  }
41
47
  finally {
48
+ await (0, console_1.sendLogCache)();
42
49
  timer.stop();
43
50
  }
44
- (0, log_events_1.emitSuccessfulFooterEvent)();
45
51
  return {
46
52
  success: true,
47
53
  body: result,
@@ -49,8 +55,6 @@ const adapter = (name) => {
49
55
  };
50
56
  }
51
57
  catch (err) {
52
- console.error(err);
53
- (0, log_events_1.emitFailedFooterEvent)();
54
58
  const errorName = (0, api_1.isForgePlatformError)(err) ? err.name : api_1.FUNCTION_ERR;
55
59
  return {
56
60
  success: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/bundler",
3
- "version": "4.10.5-next.9",
3
+ "version": "4.11.0",
4
4
  "description": "Default bundler for Forge apps",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Atlassian",
@@ -12,18 +12,18 @@
12
12
  "clean": "rm -rf ./out && rm -f tsconfig.tsbuildinfo"
13
13
  },
14
14
  "dependencies": {
15
- "@babel/core": "^7.22.9",
15
+ "@babel/core": "^7.22.10",
16
16
  "@babel/plugin-transform-class-properties": "^7.22.5",
17
17
  "@babel/plugin-transform-class-static-block": "^7.22.5",
18
18
  "@babel/plugin-transform-numeric-separator": "^7.22.5",
19
- "@babel/plugin-transform-optional-chaining": "^7.22.6",
19
+ "@babel/plugin-transform-optional-chaining": "^7.22.10",
20
20
  "@babel/plugin-transform-react-jsx": "^7.22.5",
21
21
  "@babel/preset-typescript": "^7.22.5",
22
- "@forge/api": "2.18.4-next.2",
23
- "@forge/babel-plugin-transform-ui": "1.1.5",
24
- "@forge/cli-shared": "3.17.1-next.6",
25
- "@forge/lint": "3.6.4-next.6",
26
- "@forge/runtime": "4.4.6-next.3",
22
+ "@forge/api": "2.18.4",
23
+ "@forge/babel-plugin-transform-ui": "1.1.6",
24
+ "@forge/cli-shared": "3.17.1",
25
+ "@forge/lint": "3.6.4",
26
+ "@forge/runtime": "4.4.6",
27
27
  "@forge/util": "1.3.1",
28
28
  "assert": "^1.5.0",
29
29
  "babel-loader": "^8.3.0",
@@ -59,7 +59,7 @@
59
59
  "@atlassian/xen-test-util": "^2.1.5",
60
60
  "@types/jest": "^29.5.3",
61
61
  "@types/node": "14.18.54",
62
- "@types/react": "^17.0.53",
62
+ "@types/react": "^17.0.64",
63
63
  "@types/readable-stream": "^2.3.15",
64
64
  "@types/webpack-bundle-analyzer": "^4.6.0",
65
65
  "@typescript-eslint/eslint-plugin": "^5.62.0",