npm package diff

Package: @forge/bundler

Versions: 4.19.0-next.12 - 4.17.4-next.0-experimental-204139e

File: package/out/config/node.js

Index: package/out/config/node.js
===================================================================
--- package/out/config/node.js
+++ package/out/config/node.js
@@ -1,23 +1,18 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
-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;
+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;
 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';
-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 = {}));
+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');
 class LocalWrapperNotFoundError extends cli_shared_1.UserError {
     constructor() {
         super('Local node runtime wrapper not found.');
     }
@@ -37,9 +32,9 @@
 exports.ParseWrapperCDNIndexError = ParseWrapperCDNIndexError;
 class LocalWrapperProvider {
     filesystemReader;
     path;
-    constructor(filesystemReader, path) {
+    constructor(filesystemReader, path = exports.LOCAL_WRAPPER_PATH) {
         this.filesystemReader = filesystemReader;
         this.path = path;
     }
     async getNodeRuntimeWrapper() {
@@ -54,12 +49,12 @@
     }
 }
 exports.LocalWrapperProvider = LocalWrapperProvider;
 class NetworkWrapperProvider {
-    wrapper;
     cdnUrl;
-    constructor() {
-        this.cdnUrl = (0, cli_shared_1.getEnvironmentConfig)(RuntimeCDN);
+    wrapper;
+    constructor(cdnUrl) {
+        this.cdnUrl = cdnUrl;
     }
     async getWrapperPathFromIndex(htmlContent, requestId) {
         const html = cheerio_1.default.load(htmlContent);
         const wrapperPath = html('script')?.get()?.[0]?.attribs['src'];
@@ -98,12 +93,15 @@
     }
 }
 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();
+    return new NetworkWrapperProvider(FORGE_RUNTIME_CDN);
 };
 exports.getWrapperProvider = getWrapperProvider;
 const getNodeRuntimeBuildConfig = (wrapperProvider) => (entrypoints, config) => {
     const webpackConfig = (0, common_1.getCommonWebpackConfig)(entrypoints, config);