@forge/cli-shared
9.3.1-next.1-experimental-0b00ed89.3.1-next.2
out/apps/template-module.js~
out/apps/template-module.jsModified+5−4
Index: package/out/apps/template-module.js
===================================================================
--- package/out/apps/template-module.js
+++ package/out/apps/template-module.js
@@ -3,8 +3,9 @@
exports.TemplateModuleServices = exports.BifrostFetchError = void 0;
const tslib_1 = require("tslib");
const fs_1 = tslib_1.__importDefault(require("fs"));
const path_1 = tslib_1.__importDefault(require("path"));
+const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
const os_1 = tslib_1.__importDefault(require("os"));
const url_1 = require("url");
const adm_zip_1 = tslib_1.__importDefault(require("adm-zip"));
const text_1 = require("../ui/text");
@@ -28,9 +29,9 @@
if (this.templatesCache) {
return this.templatesCache;
}
const indexUrl = new url_1.URL(MODULE_INDEX_FILE, this.baseUrl);
- const res = await fetch(indexUrl);
+ const res = await (0, node_fetch_1.default)(indexUrl);
if (!res.ok) {
throw new BifrostFetchError(text_1.Text.module.errors.bifrostIndexFetchFailed(res.status, res.statusText));
}
const json = await res.json();
@@ -41,17 +42,17 @@
throw new BifrostFetchError(text_1.Text.module.errors.bifrostIndexInvalid);
}
async fetchModuleShowMeta(moduleKey) {
const url = `${this.baseUrl}${moduleKey}/${MODULE_SHOW_FILE}`;
- const res = await fetch(url);
+ const res = await (0, node_fetch_1.default)(url);
if (!res.ok) {
throw new BifrostFetchError(text_1.Text.module.errors.bifrostIndexFetchFailed(res.status, res.statusText));
}
return (await res.json());
}
async fetchManifestFragment(manifestPath) {
const url = `${this.baseUrl}${manifestPath}`;
- const res = await fetch(url);
+ const res = await (0, node_fetch_1.default)(url);
if (!res.ok) {
throw new BifrostFetchError(text_1.Text.module.errors.bifrostManifestFragmentFetchFailed(res.status, res.statusText));
}
return await res.text();
@@ -93,9 +94,9 @@
const rel = uiFramework ? `${template.moduleKey}/${uiFramework}/bundle.zip` : `${template.moduleKey}/bundle.zip`;
const url = `${this.baseUrl}${rel}`;
let res;
try {
- res = await fetch(url);
+ res = await (0, node_fetch_1.default)(url);
}
catch (err) {
const message = err instanceof Error ? err.message : String(err);
throw new Error(text_1.Text.module.add.errorFailedToDownloadBundle(template.moduleKey, message), { cause: err });