@forge/bundler 4.7.0-next.8 → 4.7.0-next.9
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 +11 -0
- package/out/stubs/http-impl.d.ts +8 -2
- package/out/stubs/http-impl.d.ts.map +1 -1
- package/out/stubs/http-impl.js +11 -5
- package/out/stubs/http-node.d.ts.map +1 -1
- package/out/stubs/http-node.js +26 -7
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @forge/bundler
|
|
2
2
|
|
|
3
|
+
## 4.7.0-next.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 96f9f6d8: Handle URL and options passed together to HTTP polyfill
|
|
8
|
+
- Updated dependencies [96f9f6d8]
|
|
9
|
+
- @forge/api@2.15.3-next.1
|
|
10
|
+
- @forge/runtime@4.3.4-next.0
|
|
11
|
+
- @forge/cli-shared@3.11.2-next.5
|
|
12
|
+
- @forge/lint@3.4.0-next.7
|
|
13
|
+
|
|
3
14
|
## 4.7.0-next.8
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/out/stubs/http-impl.d.ts
CHANGED
|
@@ -12,11 +12,17 @@ export interface ChainableOptions {
|
|
|
12
12
|
[key: string]: string;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
export declare
|
|
15
|
+
export declare type Callback = (res: IncomingMessage) => void;
|
|
16
|
+
export declare type Arg = RequestOptions | string | URL | Callback;
|
|
17
|
+
export declare const isCallback: (options: Arg) => options is Callback;
|
|
18
|
+
export declare const isString: (options: Arg) => options is string;
|
|
19
|
+
export declare const isURL: (options: Arg) => options is URL;
|
|
20
|
+
export declare const isStringOrURL: (options: Arg) => options is string | URL;
|
|
21
|
+
export declare const isRequestOptions: (options: Arg) => options is RequestOptions;
|
|
16
22
|
export declare class Request extends Writable {
|
|
17
23
|
private reqBody;
|
|
18
24
|
private chainableOptions;
|
|
19
|
-
constructor(options: RequestOptions | string | URL, callback?:
|
|
25
|
+
constructor(options: RequestOptions | string | URL, callback?: Callback);
|
|
20
26
|
setHeader(name: string, value: string): Request;
|
|
21
27
|
setTimeout(value: number, callback?: () => void): Request;
|
|
22
28
|
private fetch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-impl.d.ts","sourceRoot":"","sources":["../../src/stubs/http-impl.ts"],"names":[],"mappings":";;;AAMA,OAAO,EAAuB,eAAe,EAAE,MAAM,MAAM,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAY,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAe,YAAY,EAAS,MAAM,YAAY,CAAC;AAwE9D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QACP,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;CACH;
|
|
1
|
+
{"version":3,"file":"http-impl.d.ts","sourceRoot":"","sources":["../../src/stubs/http-impl.ts"],"names":[],"mappings":";;;AAMA,OAAO,EAAuB,eAAe,EAAE,MAAM,MAAM,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAY,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAe,YAAY,EAAS,MAAM,YAAY,CAAC;AAwE9D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QACP,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;CACH;AAED,oBAAY,QAAQ,GAAG,CAAC,GAA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ID,qBAAa,KAAK;gBACJ,OAAO,EAAE,YAAY;CAOlC"}
|
package/out/stubs/http-impl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Agent = exports.Request = exports.isRequestOptions = void 0;
|
|
3
|
+
exports.Agent = exports.Request = exports.isRequestOptions = exports.isStringOrURL = exports.isURL = exports.isString = exports.isCallback = void 0;
|
|
4
4
|
const readable_stream_1 = require("readable-stream");
|
|
5
5
|
const api_1 = require("@forge/api");
|
|
6
6
|
const HEADERS_DISCARD_DUPLICATES = new Set([
|
|
@@ -56,9 +56,15 @@ class Response extends readable_stream_1.Readable {
|
|
|
56
56
|
this.push(null);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
+
const isCallback = (options) => typeof options === 'function';
|
|
60
|
+
exports.isCallback = isCallback;
|
|
59
61
|
const isString = (options) => typeof options === 'string';
|
|
62
|
+
exports.isString = isString;
|
|
60
63
|
const isURL = (options) => typeof options === 'object' && options.constructor.name === 'URL';
|
|
61
|
-
|
|
64
|
+
exports.isURL = isURL;
|
|
65
|
+
const isStringOrURL = (options) => (0, exports.isString)(options) || (0, exports.isURL)(options);
|
|
66
|
+
exports.isStringOrURL = isStringOrURL;
|
|
67
|
+
const isRequestOptions = (options) => !(0, exports.isStringOrURL)(options) && !(0, exports.isCallback)(options);
|
|
62
68
|
exports.isRequestOptions = isRequestOptions;
|
|
63
69
|
class Request extends readable_stream_1.Writable {
|
|
64
70
|
constructor(options, callback) {
|
|
@@ -130,10 +136,10 @@ class Request extends readable_stream_1.Writable {
|
|
|
130
136
|
return `${protocol}//${auth}${host}${port}${path}`;
|
|
131
137
|
}
|
|
132
138
|
static urlFromFetchArgs(options) {
|
|
133
|
-
if (isString(options)) {
|
|
139
|
+
if ((0, exports.isString)(options)) {
|
|
134
140
|
return options;
|
|
135
141
|
}
|
|
136
|
-
else if (isURL(options)) {
|
|
142
|
+
else if ((0, exports.isURL)(options)) {
|
|
137
143
|
return options.toString();
|
|
138
144
|
}
|
|
139
145
|
else {
|
|
@@ -148,7 +154,7 @@ class Request extends readable_stream_1.Writable {
|
|
|
148
154
|
}
|
|
149
155
|
static convertToForgeFetchArgs(options, chainableOptions) {
|
|
150
156
|
const url = Request.urlFromFetchArgs(options);
|
|
151
|
-
if (
|
|
157
|
+
if ((0, exports.isStringOrURL)(options)) {
|
|
152
158
|
return { url, init: chainableOptions };
|
|
153
159
|
}
|
|
154
160
|
else {
|
|
@@ -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":"AAkEA,wBAAgB,YAAY,SAK3B;AAED,wBAAgB,YAAY,SAG3B"}
|
package/out/stubs/http-node.js
CHANGED
|
@@ -1,22 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.restoreHttps = exports.replaceHttps = void 0;
|
|
4
|
+
const url_1 = require("url");
|
|
4
5
|
const http_impl_1 = require("./http-impl");
|
|
5
6
|
const https = require('https');
|
|
6
7
|
const originalHttpsRequest = https.request;
|
|
7
8
|
const originalHttpsGet = https.get;
|
|
8
|
-
function
|
|
9
|
+
function parseArgs(args) {
|
|
10
|
+
const result = {
|
|
11
|
+
options: {}
|
|
12
|
+
};
|
|
13
|
+
if (args.length > 0 && (0, http_impl_1.isStringOrURL)(args[0])) {
|
|
14
|
+
const url = (0, http_impl_1.isString)(args[0]) ? new url_1.URL(args[0]) : args[0];
|
|
15
|
+
result.options = (0, url_1.urlToHttpOptions)(url);
|
|
16
|
+
args.shift();
|
|
17
|
+
}
|
|
18
|
+
if (args.length > 0 && (0, http_impl_1.isRequestOptions)(args[0])) {
|
|
19
|
+
result.options = Object.assign(result.options, args[0]);
|
|
20
|
+
args.shift();
|
|
21
|
+
}
|
|
22
|
+
if (args.length > 0 && (0, http_impl_1.isCallback)(args[0])) {
|
|
23
|
+
result.callback = args[0];
|
|
24
|
+
args.shift();
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
function request(...args) {
|
|
9
29
|
var _a;
|
|
10
|
-
|
|
30
|
+
const { options, callback } = parseArgs(args);
|
|
31
|
+
if ((_a = options === null || options === void 0 ? void 0 : options.headers) === null || _a === void 0 ? void 0 : _a['Forge-Proxy-Authorization']) {
|
|
11
32
|
return originalHttpsRequest(options, callback);
|
|
12
33
|
}
|
|
13
34
|
return new http_impl_1.Request(options, callback);
|
|
14
35
|
}
|
|
15
|
-
function get(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
const result = request(options, callback);
|
|
36
|
+
function get(...args) {
|
|
37
|
+
const { options, callback } = parseArgs(args);
|
|
38
|
+
const result = request(Object.assign(Object.assign({}, options), { method: 'GET' }), ...(callback ? [callback] : []));
|
|
20
39
|
result.end();
|
|
21
40
|
return result;
|
|
22
41
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/bundler",
|
|
3
|
-
"version": "4.7.0-next.
|
|
3
|
+
"version": "4.7.0-next.9",
|
|
4
4
|
"description": "Default bundler for Forge apps",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Atlassian",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
|
|
19
19
|
"@babel/plugin-transform-react-jsx": "^7.16.7",
|
|
20
20
|
"@babel/preset-typescript": "^7.16.7",
|
|
21
|
-
"@forge/api": "2.15.3-next.
|
|
21
|
+
"@forge/api": "2.15.3-next.1",
|
|
22
22
|
"@forge/babel-plugin-transform-ui": "1.1.2",
|
|
23
|
-
"@forge/cli-shared": "3.11.2-next.
|
|
24
|
-
"@forge/lint": "3.4.0-next.
|
|
25
|
-
"@forge/runtime": "4.3.
|
|
23
|
+
"@forge/cli-shared": "3.11.2-next.5",
|
|
24
|
+
"@forge/lint": "3.4.0-next.7",
|
|
25
|
+
"@forge/runtime": "4.3.4-next.0",
|
|
26
26
|
"@forge/util": "1.2.3",
|
|
27
27
|
"assert": "^1.1.1",
|
|
28
28
|
"babel-loader": "^8.2.3",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@atlassian/xen-test-util": "^1.1.1",
|
|
58
58
|
"@types/jest": "^29.1.2",
|
|
59
|
-
"@types/node": "14.18.
|
|
59
|
+
"@types/node": "14.18.44",
|
|
60
60
|
"@types/react": "^17.0.53",
|
|
61
61
|
"@types/readable-stream": "^2.3.15",
|
|
62
62
|
"@types/webpack-bundle-analyzer": "^4.6.0",
|