@forge/bundler 7.1.0-next.12-experimental-4b981ef → 7.1.0-next.13
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 +6 -26
- package/out/common.d.ts +0 -1
- package/out/common.d.ts.map +1 -1
- package/out/common.js +3 -3
- package/out/config/common.d.ts.map +1 -1
- package/out/config/common.js +1 -0
- package/out/runtime.d.ts.map +1 -1
- package/out/runtime.js +3 -0
- package/out/text.d.ts +1 -0
- package/out/text.d.ts.map +1 -1
- package/out/text.js +2 -1
- package/out/typescript.d.ts.map +1 -1
- package/out/typescript.js +2 -1
- package/out/wrapper-provider.d.ts +0 -8
- package/out/wrapper-provider.d.ts.map +1 -1
- package/out/wrapper-provider.js +5 -48
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,34 +1,14 @@
|
|
|
1
1
|
# @forge/bundler
|
|
2
2
|
|
|
3
|
-
## 7.1.0-next.
|
|
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
|
|
3
|
+
## 7.1.0-next.13
|
|
10
4
|
|
|
11
5
|
### Patch Changes
|
|
12
6
|
|
|
13
|
-
-
|
|
14
|
-
- Updated dependencies [
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
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
|
|
7
|
+
- 4b90a07: Lint target directory when using the manual packaging
|
|
8
|
+
- Updated dependencies [4b90a07]
|
|
9
|
+
- @forge/manifest@13.3.0-next.8
|
|
10
|
+
- @forge/lint@6.0.3-next.13
|
|
11
|
+
- @forge/cli-shared@9.3.0-next.12
|
|
32
12
|
|
|
33
13
|
## 7.1.0-next.12
|
|
34
14
|
|
package/out/common.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Handler } from '@forge/cli-shared';
|
|
2
2
|
import { BundlerArgs, EntryPoint } from './types';
|
|
3
3
|
export declare function getOutputDir(args: Pick<BundlerArgs, 'watchMode'>): string;
|
|
4
|
-
export declare const SOURCE_DIR = "src";
|
|
5
4
|
export declare const NODE_MODULES_DIR = "node_modules";
|
|
6
5
|
export declare function getEntryPoints(handlers: Handler[]): EntryPoint[];
|
|
7
6
|
export declare function createEntryPointsForResource(resourceKey: string, resourcePath: string, entry?: Record<string, string>): EntryPoint[];
|
package/out/common.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAmC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAmC,MAAM,mBAAmB,CAAC;AAG7E,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAElD,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,GAAG,MAAM,CAKzE;AAED,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAE/C,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,CAOhE;AAgBD,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,UAAU,EAAE,CAYd"}
|
package/out/common.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NODE_MODULES_DIR =
|
|
3
|
+
exports.NODE_MODULES_DIR = void 0;
|
|
4
4
|
exports.getOutputDir = getOutputDir;
|
|
5
5
|
exports.getEntryPoints = getEntryPoints;
|
|
6
6
|
exports.createEntryPointsForResource = createEntryPointsForResource;
|
|
7
7
|
const tslib_1 = require("tslib");
|
|
8
8
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
9
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
10
|
+
const manifest_1 = require("@forge/manifest");
|
|
10
11
|
function getOutputDir(args) {
|
|
11
12
|
const outputDir = args.watchMode === 'debug' ? path_1.default.resolve(cli_shared_1.TUNNEL_BUNDLE_DIRECTORY) : (0, cli_shared_1.tmpDir)('dist');
|
|
12
13
|
return outputDir;
|
|
13
14
|
}
|
|
14
|
-
exports.SOURCE_DIR = 'src';
|
|
15
15
|
exports.NODE_MODULES_DIR = 'node_modules';
|
|
16
16
|
function getEntryPoints(handlers) {
|
|
17
17
|
const modules = new Set(handlers.map(({ module }) => module));
|
|
18
18
|
return Array.from(modules).map((module) => ({
|
|
19
19
|
name: module,
|
|
20
|
-
path: path_1.default.resolve(
|
|
20
|
+
path: path_1.default.resolve(manifest_1.SOURCE_DIRECTORY, module)
|
|
21
21
|
}));
|
|
22
22
|
}
|
|
23
23
|
function createEntryPointsForResource(resourceKey, resourcePath, entry) {
|
|
@@ -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E,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
|
],
|
package/out/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAiC,cAAc,EAAa,MAAM,mBAAmB,CAAC;AAEnH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKjD,OAAO,EAEL,OAAO,EAOR,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAiB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAK3E,eAAO,MAAM,sBAAsB,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAiC,cAAc,EAAa,MAAM,mBAAmB,CAAC;AAEnH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKjD,OAAO,EAEL,OAAO,EAOR,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAiB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAK3E,eAAO,MAAM,sBAAsB,kBAAkB,CAAC;AAkOtD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,GAC7B,OAAO,CAET"}
|
package/out/runtime.js
CHANGED
|
@@ -144,6 +144,9 @@ class ConfigBundler {
|
|
|
144
144
|
}
|
|
145
145
|
async getBundler() {
|
|
146
146
|
const config = (await this.configReader.readConfig()).app.package;
|
|
147
|
+
if (config?.path && config?.bundler !== 'manual@2026') {
|
|
148
|
+
throw new cli_shared_1.UserError(text_1.Text.packagePathOnlySupportedForManualBundler);
|
|
149
|
+
}
|
|
147
150
|
if (config?.bundler === 'typescript') {
|
|
148
151
|
if (!(await this.statsigService.isTypescriptBundlerEnabled())) {
|
|
149
152
|
throw new cli_shared_1.UserError(text_1.Text.typescriptBundlerEAP);
|
package/out/text.d.ts
CHANGED
package/out/text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI;mCACgB,MAAM,EAAE;8BACb,MAAM,EAAE;;4BAKV,KAAK
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI;mCACgB,MAAM,EAAE;8BACb,MAAM,EAAE;;4BAKV,KAAK;;;;CAI9B,CAAC"}
|
package/out/text.js
CHANGED
|
@@ -8,5 +8,6 @@ exports.Text = {
|
|
|
8
8
|
noExecutableFile: 'Could not find the main executable file',
|
|
9
9
|
metadataFailed: (error) => `Application code metadata processing failed: ${error.message}`,
|
|
10
10
|
typescriptBundlerEAP: `TypeScript bundler is a Forge EAP feature. Please see ${cli_shared_1.Text.go('dac/platform/forge/manifest-reference/#package')} for more details.`,
|
|
11
|
-
manualBundlerPathRequired: 'For manual packaging, the path to the packaged runtime code is required.'
|
|
11
|
+
manualBundlerPathRequired: 'For manual packaging, the path to the packaged runtime code is required.',
|
|
12
|
+
packagePathOnlySupportedForManualBundler: 'The package path is only needed when the application is packaged manually.'
|
|
12
13
|
};
|
package/out/typescript.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../src/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAIpD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAIlC,OAAO,EAA4B,MAAM,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../src/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAIpD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAIlC,OAAO,EAA4B,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAUrE,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,aAAa,EACb,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAEnB,MAAM,SAAS,CAAC;AAGjB,KAAK,aAAa,GAAG,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AAE/D,8BAAsB,iBAAkB,YAAW,OAAO;IAC5C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM;IAE7C,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa;IAwB5E,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;cAWnC,SAAS,CACvB,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,EACf,iBAAiB,CAAC,EAAE,iBAAiB,GACpC,OAAO,CAAC,aAAa,CAAC;IAkBnB,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IA4BjD,KAAK,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA8DtF"}
|
package/out/typescript.js
CHANGED
|
@@ -7,6 +7,7 @@ const path_1 = tslib_1.__importDefault(require("path"));
|
|
|
7
7
|
const readline_1 = require("readline");
|
|
8
8
|
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
|
9
9
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
10
|
+
const manifest_1 = require("@forge/manifest");
|
|
10
11
|
const common_1 = require("./common");
|
|
11
12
|
const dependencies_1 = require("./dependencies");
|
|
12
13
|
const text_1 = require("./text");
|
|
@@ -20,7 +21,7 @@ class TypeScriptBundler {
|
|
|
20
21
|
runTypeScript(args, outputDir) {
|
|
21
22
|
const processArgs = [];
|
|
22
23
|
processArgs.push('--project', args.appDirectory);
|
|
23
|
-
processArgs.push('--rootDir', path_1.default.join(args.appDirectory,
|
|
24
|
+
processArgs.push('--rootDir', path_1.default.join(args.appDirectory, manifest_1.SOURCE_DIRECTORY));
|
|
24
25
|
if (args.watchMode) {
|
|
25
26
|
processArgs.push('--watch');
|
|
26
27
|
}
|
|
@@ -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,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,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;YAI/C,sBAAsB;IAgBpC,OAAO,CAAC,cAAc,CAuCpB;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,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.0-next.
|
|
3
|
+
"version": "7.1.0-next.13",
|
|
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.12",
|
|
25
25
|
"@forge/i18n": "1.0.0",
|
|
26
|
-
"@forge/lint": "6.0.3-next.
|
|
27
|
-
"@forge/manifest": "13.3.0-next.
|
|
26
|
+
"@forge/lint": "6.0.3-next.13",
|
|
27
|
+
"@forge/manifest": "13.3.0-next.8",
|
|
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",
|