@forge/bundler 7.1.0-next.11 → 7.1.0-next.12-experimental-4b981ef
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,43 @@
|
|
|
1
1
|
# @forge/bundler
|
|
2
2
|
|
|
3
|
+
## 7.1.0-next.12-experimental-4b981ef
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- efa5897: Move from node-fetch to native fetch
|
|
8
|
+
- a36d70b: Implement manual bundler
|
|
9
|
+
- d1610cc: Manual runtime packaging option
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [4d50a76]
|
|
14
|
+
- Updated dependencies [efa5897]
|
|
15
|
+
- Updated dependencies [0f6f64f]
|
|
16
|
+
- Updated dependencies [f01417b]
|
|
17
|
+
- Updated dependencies [18b920d]
|
|
18
|
+
- Updated dependencies [d706cd8]
|
|
19
|
+
- Updated dependencies [0949833]
|
|
20
|
+
- Updated dependencies [a36d70b]
|
|
21
|
+
- Updated dependencies [d1610cc]
|
|
22
|
+
- Updated dependencies [e7bfe5e]
|
|
23
|
+
- Updated dependencies [bc2d278]
|
|
24
|
+
- Updated dependencies [498fda5]
|
|
25
|
+
- Updated dependencies [ca4fa27]
|
|
26
|
+
- Updated dependencies [89ccb1e]
|
|
27
|
+
- Updated dependencies [39f1f15]
|
|
28
|
+
- Updated dependencies [c3a0f20]
|
|
29
|
+
- @forge/cli-shared@9.3.0-next.11-experimental-4b981ef
|
|
30
|
+
- @forge/lint@6.0.3-next.12-experimental-4b981ef
|
|
31
|
+
- @forge/manifest@13.3.0-next.7-experimental-4b981ef
|
|
32
|
+
|
|
33
|
+
## 7.1.0-next.12
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Updated dependencies [18b920d]
|
|
38
|
+
- @forge/cli-shared@9.3.0-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,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AAElC,eAAO,MAAM,WAAW,GAAI,YAAY,YAAY;;;;;+DAIe;YAAE,MAAM,EAAE;gBAAE,QAAQ,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE;;CAalG,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,MAAM,WAAW,KAAG,mBA0F1D,CAAC"}
|
package/out/config/common.js
CHANGED
|
@@ -75,7 +75,6 @@ const getCommonWebpackConfig = (args) => {
|
|
|
75
75
|
modules: require.resolve.paths('babel-loader') || undefined
|
|
76
76
|
},
|
|
77
77
|
plugins: [
|
|
78
|
-
new webpack_1.default.IgnorePlugin({ resourceRegExp: /^encoding$/, contextRegExp: /node-fetch/ }),
|
|
79
78
|
new webpack_1.default.IgnorePlugin({ resourceRegExp: /^(bufferutil|utf-8-validate)$/, contextRegExp: /ws\/lib$/ }),
|
|
80
79
|
new webpack_1.default.IgnorePlugin({ resourceRegExp: /^dtrace-provider$/, contextRegExp: /bunyan$/ })
|
|
81
80
|
],
|
|
@@ -17,6 +17,12 @@ export interface WrapperProvider {
|
|
|
17
17
|
getNodeRuntimeWrapper(): Promise<RuntimeScript>;
|
|
18
18
|
getNodeRuntimeLoader(): Promise<RuntimeScript | undefined>;
|
|
19
19
|
}
|
|
20
|
+
type RuntimeFetchResponse = {
|
|
21
|
+
ok: boolean;
|
|
22
|
+
status: number;
|
|
23
|
+
headers: Headers;
|
|
24
|
+
text: () => Promise<string>;
|
|
25
|
+
};
|
|
20
26
|
export declare class LocalWrapperProvider implements WrapperProvider {
|
|
21
27
|
private readonly filesystemReader;
|
|
22
28
|
private readonly runtimePath;
|
|
@@ -31,6 +37,7 @@ export declare class NetworkWrapperProvider implements WrapperProvider {
|
|
|
31
37
|
private loader;
|
|
32
38
|
protected cdnUrl: string;
|
|
33
39
|
constructor(statsigService: StatsigService);
|
|
40
|
+
protected getFromNodeRequest: (url: string) => Promise<RuntimeFetchResponse>;
|
|
34
41
|
private getScriptPathFromIndex;
|
|
35
42
|
private getFileFromCDN;
|
|
36
43
|
getNodeRuntimeWrapper(): Promise<RuntimeScript>;
|
|
@@ -40,4 +47,5 @@ export declare const getWrapperProvider: ({ fileSystemReader, statsigService }:
|
|
|
40
47
|
fileSystemReader: FileSystemReader;
|
|
41
48
|
statsigService: StatsigService;
|
|
42
49
|
}) => LocalWrapperProvider | NetworkWrapperProvider;
|
|
50
|
+
export {};
|
|
43
51
|
//# sourceMappingURL=wrapper-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapper-provider.d.ts","sourceRoot":"","sources":["../src/wrapper-provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wrapper-provider.d.ts","sourceRoot":"","sources":["../src/wrapper-provider.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,SAAS,EAGT,cAAc,EACf,MAAM,mBAAmB,CAAC;AAW3B,qBAAa,yBAA0B,SAAQ,SAAS;;CAIvD;AAED,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAGhD;AAED,qBAAa,yBAA0B,SAAQ,SAAS;gBAC1C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS;CAG3D;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;IAChD,oBAAoB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;CAC5D;AAOD,KAAK,oBAAoB,GAAG;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC;AAiCF,qBAAa,oBAAqB,YAAW,eAAe;IAExD,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW;gBADX,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,MAAM;YAExB,cAAc;IAatB,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC;IAI/C,oBAAoB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAGjE;AAED,qBAAa,sBAAuB,YAAW,eAAe;IAKhD,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc;IAJ7D,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,MAAM,CAA4B;IAC1C,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEM,cAAc,EAAE,cAAc;IAI7D,SAAS,CAAC,kBAAkB,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,oBAAoB,CAAC,CAqB/E;YAEY,sBAAsB;IAgBpC,OAAO,CAAC,cAAc,CAyCpB;IAEI,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC;IAO/C,oBAAoB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAQjE;AAED,eAAO,MAAM,kBAAkB,GAAI,sCAGhC;IACD,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,cAAc,EAAE,cAAc,CAAC;CAChC,kDAQA,CAAC"}
|
package/out/wrapper-provider.js
CHANGED
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getWrapperProvider = exports.NetworkWrapperProvider = exports.LocalWrapperProvider = exports.ParseWrapperCDNIndexError = exports.WrapperNetworkError = exports.LocalWrapperNotFoundError = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
+
const http_1 = tslib_1.__importDefault(require("http"));
|
|
7
|
+
const https_1 = tslib_1.__importDefault(require("https"));
|
|
8
|
+
const url_1 = require("url");
|
|
6
9
|
const cheerio_1 = require("cheerio");
|
|
7
|
-
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
8
10
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
9
11
|
var RuntimeCDN;
|
|
10
12
|
(function (RuntimeCDN) {
|
|
@@ -37,6 +39,30 @@ var ScriptType;
|
|
|
37
39
|
ScriptType["WRAPPER"] = "wrapper";
|
|
38
40
|
ScriptType["LOADER"] = "loader";
|
|
39
41
|
})(ScriptType || (ScriptType = {}));
|
|
42
|
+
const NODE_REQUEST_TIMEOUT_MS = 30_000;
|
|
43
|
+
const DEFAULT_HTTP_ERROR_STATUS = 500;
|
|
44
|
+
const toHeaders = (rawHeaders) => {
|
|
45
|
+
const responseHeaders = new Headers();
|
|
46
|
+
Object.entries(rawHeaders).forEach(([key, value]) => {
|
|
47
|
+
if (Array.isArray(value)) {
|
|
48
|
+
value.forEach((headerValue) => responseHeaders.append(key, headerValue));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (typeof value === 'string') {
|
|
52
|
+
responseHeaders.set(key, value);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return responseHeaders;
|
|
56
|
+
};
|
|
57
|
+
const toRuntimeFetchResponse = (response, chunks, headers) => {
|
|
58
|
+
const status = response.statusCode ?? DEFAULT_HTTP_ERROR_STATUS;
|
|
59
|
+
return {
|
|
60
|
+
ok: status >= 200 && status < 300,
|
|
61
|
+
status,
|
|
62
|
+
headers,
|
|
63
|
+
text: async () => Buffer.concat(chunks).toString('utf8')
|
|
64
|
+
};
|
|
65
|
+
};
|
|
40
66
|
class LocalWrapperProvider {
|
|
41
67
|
filesystemReader;
|
|
42
68
|
runtimePath;
|
|
@@ -73,6 +99,23 @@ class NetworkWrapperProvider {
|
|
|
73
99
|
this.statsigService = statsigService;
|
|
74
100
|
this.cdnUrl = (0, cli_shared_1.getEnvironmentConfig)(RuntimeCDN);
|
|
75
101
|
}
|
|
102
|
+
getFromNodeRequest = async (url) => {
|
|
103
|
+
return await new Promise((resolve, reject) => {
|
|
104
|
+
const parsedUrl = new url_1.URL(url);
|
|
105
|
+
const requestClient = parsedUrl.protocol === 'https:' ? https_1.default : http_1.default;
|
|
106
|
+
const request = requestClient.get(parsedUrl, (response) => {
|
|
107
|
+
const body = [];
|
|
108
|
+
response.on('data', (chunk) => body.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)));
|
|
109
|
+
response.on('end', () => {
|
|
110
|
+
resolve(toRuntimeFetchResponse(response, body, toHeaders(response.headers)));
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
request.setTimeout(NODE_REQUEST_TIMEOUT_MS, () => {
|
|
114
|
+
request.destroy(new Error(`Request timed out after ${NODE_REQUEST_TIMEOUT_MS}ms`));
|
|
115
|
+
});
|
|
116
|
+
request.on('error', reject);
|
|
117
|
+
});
|
|
118
|
+
};
|
|
76
119
|
async getScriptPathFromIndex(htmlContent, requestId, scriptType) {
|
|
77
120
|
const html = (0, cheerio_1.load)(htmlContent, { xml: { xmlMode: false } });
|
|
78
121
|
const scriptPath = html('script')
|
|
@@ -81,16 +124,16 @@ class NetworkWrapperProvider {
|
|
|
81
124
|
if (typeof scriptPath !== 'string') {
|
|
82
125
|
throw new ParseWrapperCDNIndexError(`Unable to parse source of runtime ${scriptType}.`, requestId);
|
|
83
126
|
}
|
|
84
|
-
return new URL(scriptPath, this.cdnUrl).toString();
|
|
127
|
+
return new url_1.URL(scriptPath, this.cdnUrl).toString();
|
|
85
128
|
}
|
|
86
129
|
getFileFromCDN = async (scriptType) => {
|
|
87
130
|
try {
|
|
88
|
-
const indexResponse = await
|
|
131
|
+
const indexResponse = await this.getFromNodeRequest(this.cdnUrl);
|
|
89
132
|
if (!indexResponse.ok) {
|
|
90
133
|
throw new WrapperNetworkError(`Failed to fetch runtime component: ${this.cdnUrl} ${indexResponse.status}.`, (0, cli_shared_1.getAtlassianTraceId)(indexResponse.headers));
|
|
91
134
|
}
|
|
92
135
|
const source = await this.getScriptPathFromIndex(await indexResponse.text(), (0, cli_shared_1.getAtlassianTraceId)(indexResponse.headers), scriptType);
|
|
93
|
-
const response = await
|
|
136
|
+
const response = await this.getFromNodeRequest(source);
|
|
94
137
|
if (!response.ok) {
|
|
95
138
|
throw new WrapperNetworkError(`Failed to fetch runtime component: ${source.toString()} ${response.status}.`, (0, cli_shared_1.getAtlassianTraceId)(response.headers));
|
|
96
139
|
}
|
|
@@ -98,7 +141,7 @@ class NetworkWrapperProvider {
|
|
|
98
141
|
return {
|
|
99
142
|
script,
|
|
100
143
|
source,
|
|
101
|
-
version: new URL(source).pathname
|
|
144
|
+
version: new url_1.URL(source).pathname
|
|
102
145
|
};
|
|
103
146
|
}
|
|
104
147
|
catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/bundler",
|
|
3
|
-
"version": "7.1.0-next.
|
|
3
|
+
"version": "7.1.0-next.12-experimental-4b981ef",
|
|
4
4
|
"description": "Default bundler for Forge apps",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Atlassian",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"@babel/plugin-transform-react-jsx": "^7.23.4",
|
|
22
22
|
"@babel/traverse": "^7.24.0",
|
|
23
23
|
"@babel/types": "^7.24.0",
|
|
24
|
-
"@forge/cli-shared": "9.3.0-next.
|
|
24
|
+
"@forge/cli-shared": "9.3.0-next.11-experimental-4b981ef",
|
|
25
25
|
"@forge/i18n": "1.0.0",
|
|
26
|
-
"@forge/lint": "6.0.3-next.
|
|
27
|
-
"@forge/manifest": "13.3.0-next.7",
|
|
26
|
+
"@forge/lint": "6.0.3-next.12-experimental-4b981ef",
|
|
27
|
+
"@forge/manifest": "13.3.0-next.7-experimental-4b981ef",
|
|
28
28
|
"babel-loader": "^8.3.0",
|
|
29
29
|
"cheerio": "^1.2.0",
|
|
30
30
|
"chokidar": "^4.0.3",
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"fs-extra": "^11.2.0",
|
|
34
34
|
"html-webpack-plugin": "^5.6.3",
|
|
35
35
|
"nock": "13.5.6",
|
|
36
|
-
"node-fetch": "2.7.0",
|
|
37
36
|
"tmp": "^0.2.3",
|
|
38
37
|
"ts-loader": "^9.5.2",
|
|
39
38
|
"type-fest": "4.10.2",
|