@forge/bundler 7.1.1-next.1-experimental-0b00ed8 → 7.1.1-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,21 +1,13 @@
|
|
|
1
1
|
# @forge/bundler
|
|
2
2
|
|
|
3
|
-
## 7.1.1-next.
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- 738b69b: Move from node-fetch to native fetch
|
|
3
|
+
## 7.1.1-next.2
|
|
8
4
|
|
|
9
5
|
### Patch Changes
|
|
10
6
|
|
|
11
|
-
- f9fba62: Add an option to inspect the application bundle
|
|
12
|
-
- Updated dependencies [71d0c4e]
|
|
13
|
-
- Updated dependencies [f9fba62]
|
|
14
|
-
- Updated dependencies [738b69b]
|
|
15
7
|
- Updated dependencies [6c1371a]
|
|
16
|
-
- @forge/
|
|
17
|
-
- @forge/
|
|
18
|
-
- @forge/
|
|
8
|
+
- @forge/manifest@13.3.1-next.0
|
|
9
|
+
- @forge/cli-shared@9.3.1-next.2
|
|
10
|
+
- @forge/lint@6.1.1-next.2
|
|
19
11
|
|
|
20
12
|
## 7.1.1-next.1
|
|
21
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/config/common.ts"],"names":[],"mappings":"AAEA,OAAgB,EAAE,aAAa,IAAI,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAIjF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAK/C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,iBAAiB,GAAI,YAAY,MAAM,KAAG,MAEtD,CAAC;AAEF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,eAAO,MAAM,gBAAgB,GAAI,eAAe,IAAI,CAAC,WAAW,EAAE,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AAM,gBAAgB,GAAI,eAAe,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,KAAG,MAShF,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC5E,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;AAC5F,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,QAAQ,GAAG,SAAS,CAAC,GACnF,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,GACrC,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,GACrC,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,mBA2F1D,CAAC"}
|
package/out/config/common.js
CHANGED
|
@@ -75,6 +75,7 @@ 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/ }),
|
|
78
79
|
new webpack_1.default.IgnorePlugin({ resourceRegExp: /^(bufferutil|utf-8-validate)$/, contextRegExp: /ws\/lib$/ }),
|
|
79
80
|
new webpack_1.default.IgnorePlugin({ resourceRegExp: /^dtrace-provider$/, contextRegExp: /bunyan$/ })
|
|
80
81
|
],
|
|
@@ -17,12 +17,6 @@ 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
|
-
};
|
|
26
20
|
export declare class LocalWrapperProvider implements WrapperProvider {
|
|
27
21
|
private readonly filesystemReader;
|
|
28
22
|
private readonly runtimePath;
|
|
@@ -37,7 +31,6 @@ export declare class NetworkWrapperProvider implements WrapperProvider {
|
|
|
37
31
|
private loader;
|
|
38
32
|
protected cdnUrl: string;
|
|
39
33
|
constructor(statsigService: StatsigService);
|
|
40
|
-
protected getFromNodeRequest: (url: string) => Promise<RuntimeFetchResponse>;
|
|
41
34
|
private getScriptPathFromIndex;
|
|
42
35
|
private getFileFromCDN;
|
|
43
36
|
getNodeRuntimeWrapper(): Promise<RuntimeScript>;
|
|
@@ -47,5 +40,4 @@ export declare const getWrapperProvider: ({ fileSystemReader, statsigService }:
|
|
|
47
40
|
fileSystemReader: FileSystemReader;
|
|
48
41
|
statsigService: StatsigService;
|
|
49
42
|
}) => LocalWrapperProvider | NetworkWrapperProvider;
|
|
50
|
-
export {};
|
|
51
43
|
//# 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":"AAKA,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,SAAS,EAGT,cAAc,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,GAAI,sCAGhC;IACD,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,cAAc,EAAE,cAAc,CAAC;CAChC,kDAQA,CAAC"}
|
package/out/wrapper-provider.js
CHANGED
|
@@ -3,10 +3,8 @@ 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");
|
|
9
6
|
const cheerio_1 = require("cheerio");
|
|
7
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
10
8
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
11
9
|
var RuntimeCDN;
|
|
12
10
|
(function (RuntimeCDN) {
|
|
@@ -39,30 +37,6 @@ var ScriptType;
|
|
|
39
37
|
ScriptType["WRAPPER"] = "wrapper";
|
|
40
38
|
ScriptType["LOADER"] = "loader";
|
|
41
39
|
})(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
|
-
};
|
|
66
40
|
class LocalWrapperProvider {
|
|
67
41
|
filesystemReader;
|
|
68
42
|
runtimePath;
|
|
@@ -99,23 +73,6 @@ class NetworkWrapperProvider {
|
|
|
99
73
|
this.statsigService = statsigService;
|
|
100
74
|
this.cdnUrl = (0, cli_shared_1.getEnvironmentConfig)(RuntimeCDN);
|
|
101
75
|
}
|
|
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
|
-
};
|
|
119
76
|
async getScriptPathFromIndex(htmlContent, requestId, scriptType) {
|
|
120
77
|
const html = (0, cheerio_1.load)(htmlContent, { xml: { xmlMode: false } });
|
|
121
78
|
const scriptPath = html('script')
|
|
@@ -124,16 +81,16 @@ class NetworkWrapperProvider {
|
|
|
124
81
|
if (typeof scriptPath !== 'string') {
|
|
125
82
|
throw new ParseWrapperCDNIndexError(`Unable to parse source of runtime ${scriptType}.`, requestId);
|
|
126
83
|
}
|
|
127
|
-
return new
|
|
84
|
+
return new URL(scriptPath, this.cdnUrl).toString();
|
|
128
85
|
}
|
|
129
86
|
getFileFromCDN = async (scriptType) => {
|
|
130
87
|
try {
|
|
131
|
-
const indexResponse = await
|
|
88
|
+
const indexResponse = await (0, node_fetch_1.default)(this.cdnUrl);
|
|
132
89
|
if (!indexResponse.ok) {
|
|
133
90
|
throw new WrapperNetworkError(`Failed to fetch runtime component: ${this.cdnUrl} ${indexResponse.status}.`, (0, cli_shared_1.getAtlassianTraceId)(indexResponse.headers));
|
|
134
91
|
}
|
|
135
92
|
const source = await this.getScriptPathFromIndex(await indexResponse.text(), (0, cli_shared_1.getAtlassianTraceId)(indexResponse.headers), scriptType);
|
|
136
|
-
const response = await
|
|
93
|
+
const response = await (0, node_fetch_1.default)(source);
|
|
137
94
|
if (!response.ok) {
|
|
138
95
|
throw new WrapperNetworkError(`Failed to fetch runtime component: ${source.toString()} ${response.status}.`, (0, cli_shared_1.getAtlassianTraceId)(response.headers));
|
|
139
96
|
}
|
|
@@ -141,7 +98,7 @@ class NetworkWrapperProvider {
|
|
|
141
98
|
return {
|
|
142
99
|
script,
|
|
143
100
|
source,
|
|
144
|
-
version: new
|
|
101
|
+
version: new URL(source).pathname
|
|
145
102
|
};
|
|
146
103
|
}
|
|
147
104
|
catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/bundler",
|
|
3
|
-
"version": "7.1.1-next.
|
|
3
|
+
"version": "7.1.1-next.2",
|
|
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.1-next.
|
|
24
|
+
"@forge/cli-shared": "9.3.1-next.2",
|
|
25
25
|
"@forge/i18n": "1.0.0",
|
|
26
|
-
"@forge/lint": "6.1.1-next.
|
|
27
|
-
"@forge/manifest": "13.3.0
|
|
26
|
+
"@forge/lint": "6.1.1-next.2",
|
|
27
|
+
"@forge/manifest": "13.3.1-next.0",
|
|
28
28
|
"babel-loader": "^8.3.0",
|
|
29
29
|
"cheerio": "^1.2.0",
|
|
30
30
|
"chokidar": "^4.0.3",
|
|
@@ -33,6 +33,7 @@
|
|
|
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",
|
|
36
37
|
"tmp": "^0.2.3",
|
|
37
38
|
"ts-loader": "^9.5.2",
|
|
38
39
|
"type-fest": "4.10.2",
|