@forge/bundler 4.10.5-next.9 → 4.11.0-next.19
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 +91 -0
- package/out/config/common.d.ts.map +1 -1
- package/out/config/common.js +5 -1
- package/out/config/node.d.ts.map +1 -1
- package/out/config/node.js +0 -6
- package/out/stubs/console.d.ts +3 -2
- package/out/stubs/console.d.ts.map +1 -1
- package/out/stubs/console.js +44 -2
- package/out/stubs/http-node.d.ts.map +1 -1
- package/out/stubs/http-node.js +9 -0
- package/out/stubs/log-events.d.ts +1 -3
- package/out/stubs/log-events.d.ts.map +1 -1
- package/out/stubs/log-events.js +2 -43
- package/out/stubs/wrapper.js +10 -6
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,96 @@
|
|
|
1
1
|
# @forge/bundler
|
|
2
2
|
|
|
3
|
+
## 4.11.0-next.19
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 63ddf65: Redirected logs through proxy
|
|
8
|
+
|
|
9
|
+
## 4.10.5-next.18
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- d33c860: Bumping dependencies via Renovate:
|
|
14
|
+
|
|
15
|
+
- @types/react
|
|
16
|
+
|
|
17
|
+
## 4.10.5-next.17
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 1d3b4b0: Bumping dependencies via Renovate:
|
|
22
|
+
|
|
23
|
+
- @types/react
|
|
24
|
+
|
|
25
|
+
## 4.10.5-next.16
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- 1d0c35c: Bumping dependencies via Renovate:
|
|
30
|
+
|
|
31
|
+
- @babel/core
|
|
32
|
+
- @babel/plugin-transform-optional-chaining
|
|
33
|
+
- @babel/traverse
|
|
34
|
+
- @babel/types
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [1d0c35c]
|
|
37
|
+
- @forge/babel-plugin-transform-ui@1.1.6-next.0
|
|
38
|
+
|
|
39
|
+
## 4.10.5-next.15
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- 854ff5d: Fix Authorize API on Node runtime
|
|
44
|
+
- Updated dependencies [854ff5d]
|
|
45
|
+
- @forge/api@2.18.4-next.3
|
|
46
|
+
- @forge/cli-shared@3.17.1-next.11
|
|
47
|
+
- @forge/lint@3.6.4-next.11
|
|
48
|
+
|
|
49
|
+
## 4.10.5-next.14
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- Updated dependencies [ea21bdd]
|
|
54
|
+
- @forge/cli-shared@3.17.1-next.10
|
|
55
|
+
- @forge/lint@3.6.4-next.10
|
|
56
|
+
|
|
57
|
+
## 4.10.5-next.13
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- e4a378c: Bumping dependencies via Renovate:
|
|
62
|
+
|
|
63
|
+
- @types/react
|
|
64
|
+
- eslint-plugin-react-hooks
|
|
65
|
+
- react
|
|
66
|
+
- react-dom
|
|
67
|
+
- react-reconciler
|
|
68
|
+
|
|
69
|
+
## 4.10.5-next.12
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- Updated dependencies [a30d4a3]
|
|
74
|
+
- @forge/cli-shared@3.17.1-next.9
|
|
75
|
+
- @forge/lint@3.6.4-next.9
|
|
76
|
+
|
|
77
|
+
## 4.10.5-next.11
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- a777103: Minor refactoring
|
|
82
|
+
- Updated dependencies [a777103]
|
|
83
|
+
- @forge/cli-shared@3.17.1-next.8
|
|
84
|
+
- @forge/runtime@4.4.6-next.4
|
|
85
|
+
- @forge/lint@3.6.4-next.8
|
|
86
|
+
|
|
87
|
+
## 4.10.5-next.10
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- @forge/cli-shared@3.17.1-next.7
|
|
92
|
+
- @forge/lint@3.6.4-next.7
|
|
93
|
+
|
|
3
94
|
## 4.10.5-next.9
|
|
4
95
|
|
|
5
96
|
### 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,
|
|
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"}
|
package/out/config/common.js
CHANGED
|
@@ -69,7 +69,11 @@ const getCommonWebpackConfig = (entrypoints, config) => {
|
|
|
69
69
|
resolveLoader: {
|
|
70
70
|
modules: require.resolve.paths('babel-loader') || undefined
|
|
71
71
|
},
|
|
72
|
-
plugins: [
|
|
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
|
{
|
package/out/config/node.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|
package/out/config/node.js
CHANGED
|
@@ -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);
|
package/out/stubs/console.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ConsoleMethod, P3LogEvent, LogHeader,
|
|
1
|
+
import { ConsoleMethod, P3LogEvent, LogHeader, HeadedLogLine } from '@forge/runtime';
|
|
2
2
|
export declare function emitTunnelEvent(event: P3LogEvent): void;
|
|
3
|
-
export declare function emitLogEvent(event:
|
|
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,
|
|
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"}
|
package/out/stubs/console.js
CHANGED
|
@@ -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
|
-
|
|
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":"
|
|
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"}
|
package/out/stubs/http-node.js
CHANGED
|
@@ -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
|
|
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,
|
|
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"}
|
package/out/stubs/log-events.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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
|
-
|
|
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;
|
package/out/stubs/wrapper.js
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "4.11.0-next.19",
|
|
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.
|
|
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.
|
|
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.
|
|
23
|
-
"@forge/babel-plugin-transform-ui": "1.1.
|
|
24
|
-
"@forge/cli-shared": "3.17.1-next.
|
|
25
|
-
"@forge/lint": "3.6.4-next.
|
|
26
|
-
"@forge/runtime": "4.4.6-next.
|
|
22
|
+
"@forge/api": "2.18.4-next.3",
|
|
23
|
+
"@forge/babel-plugin-transform-ui": "1.1.6-next.0",
|
|
24
|
+
"@forge/cli-shared": "3.17.1-next.11",
|
|
25
|
+
"@forge/lint": "3.6.4-next.11",
|
|
26
|
+
"@forge/runtime": "4.4.6-next.4",
|
|
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.
|
|
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",
|