npm package diff
Package: @forge/bundler
Versions: 4.17.4-next.0-experimental-10722bc - 4.19.0-next.13
File: package/out/config/node.js
Index: package/out/config/node.js
===================================================================
--- package/out/config/node.js
+++ package/out/config/node.js
@@ -1,18 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-exports.getNodeRuntimeBuildConfig = exports.getWrapperProvider = exports.NetworkWrapperProvider = exports.LocalWrapperProvider = exports.ParseWrapperCDNIndexError = exports.WrapperNetworkError = exports.LocalWrapperNotFoundError = exports.LOCAL_WRAPPER_PATH = exports.NODE_RUNTIME_VERSION_FILE = exports.NODE_WEBPACK_USER_CODE_DIR = exports.NODE_WEBPACK_CONFIG_NAME = void 0;
+exports.getNodeRuntimeBuildConfig = exports.getWrapperProvider = exports.NetworkWrapperProvider = exports.LocalWrapperProvider = exports.ParseWrapperCDNIndexError = exports.WrapperNetworkError = exports.LocalWrapperNotFoundError = exports.NODE_RUNTIME_VERSION_FILE = exports.NODE_WEBPACK_USER_CODE_DIR = exports.NODE_WEBPACK_CONFIG_NAME = void 0;
const tslib_1 = require("tslib");
-const path_1 = tslib_1.__importDefault(require("path"));
const cheerio_1 = tslib_1.__importDefault(require("cheerio"));
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
const cli_shared_1 = require("@forge/cli-shared");
const common_1 = require("./common");
exports.NODE_WEBPACK_CONFIG_NAME = 'node-runtime';
exports.NODE_WEBPACK_USER_CODE_DIR = 'bundled';
exports.NODE_RUNTIME_VERSION_FILE = 'runtime.json';
-const FORGE_RUNTIME_CDN = 'https://forge-node-runtime.prod-east.frontend.public.atl-paas.net/';
-exports.LOCAL_WRAPPER_PATH = path_1.default.resolve(__dirname, '..', '..', '..', 'forge-node-runtime', 'dist', 'wrapper.js');
+var RuntimeCDN;
+(function (RuntimeCDN) {
+ RuntimeCDN["DEV"] = "https://forge-node-runtime.stg-east.frontend.public.atl-paas.net/";
+ RuntimeCDN["STG"] = "https://forge-node-runtime.stg-east.frontend.public.atl-paas.net/";
+ RuntimeCDN["PROD"] = "https://forge-node-runtime.prod-east.frontend.public.atl-paas.net/";
+ RuntimeCDN["FEDRAMP_MODERATE_STAGING"] = "https://forge-node-runtime.prod-east.frontend.public.atl-paas.net/";
+ RuntimeCDN["FEDRAMP_MODERATE_PROD"] = "https://forge-node-runtime.prod-east.frontend.public.atl-paas.net/";
+})(RuntimeCDN || (RuntimeCDN = {}));
class LocalWrapperNotFoundError extends cli_shared_1.UserError {
constructor() {
super('Local node runtime wrapper not found.');
}
@@ -32,9 +37,9 @@
exports.ParseWrapperCDNIndexError = ParseWrapperCDNIndexError;
class LocalWrapperProvider {
filesystemReader;
path;
- constructor(filesystemReader, path = exports.LOCAL_WRAPPER_PATH) {
+ constructor(filesystemReader, path) {
this.filesystemReader = filesystemReader;
this.path = path;
}
async getNodeRuntimeWrapper() {
@@ -49,12 +54,12 @@
}
}
exports.LocalWrapperProvider = LocalWrapperProvider;
class NetworkWrapperProvider {
- cdnUrl;
wrapper;
- constructor(cdnUrl) {
- this.cdnUrl = cdnUrl;
+ cdnUrl;
+ constructor() {
+ this.cdnUrl = (0, cli_shared_1.getEnvironmentConfig)(RuntimeCDN);
}
async getWrapperPathFromIndex(htmlContent, requestId) {
const html = cheerio_1.default.load(htmlContent);
const wrapperPath = html('script')?.get()?.[0]?.attribs['src'];
@@ -93,15 +98,12 @@
}
}
exports.NetworkWrapperProvider = NetworkWrapperProvider;
const getWrapperProvider = ({ fileSystemReader }) => {
- if (process.env.FORGE_USE_LOCAL_WRAPPER === 'true') {
- return new LocalWrapperProvider(fileSystemReader);
- }
if (process.env.FORGE_WRAPPER_PATH) {
return new LocalWrapperProvider(fileSystemReader, process.env.FORGE_WRAPPER_PATH);
}
- return new NetworkWrapperProvider(FORGE_RUNTIME_CDN);
+ return new NetworkWrapperProvider();
};
exports.getWrapperProvider = getWrapperProvider;
const getNodeRuntimeBuildConfig = (wrapperProvider) => (entrypoints, config) => {
const webpackConfig = (0, common_1.getCommonWebpackConfig)(entrypoints, config);