npm package diff

Package: @forge/manifest

Versions: 7.7.0-next.12 - 7.5.2-next.0-experimental-204139e

File: package/out/interpolator/environment-variable-interpolator.js

Index: package/out/interpolator/environment-variable-interpolator.js
===================================================================
--- package/out/interpolator/environment-variable-interpolator.js
+++ package/out/interpolator/environment-variable-interpolator.js
@@ -1,47 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.EnvironmentVariableInterpolator = exports.EnvironmentVariableInterpolatorError = void 0;
-const tslib_1 = require("tslib");
-const yaml_1 = require("yaml");
-const manifest_interpolator_1 = require("./manifest-interpolator");
-const text_1 = require("../text");
-const Sentry = tslib_1.__importStar(require("@sentry/node"));
-class EnvironmentVariableInterpolatorError extends manifest_interpolator_1.ManifestInterpolatorError {
-    constructor(message) {
-        super(message);
-        this.name = 'EnvironmentVariableInterpolatorError';
-    }
-}
-exports.EnvironmentVariableInterpolatorError = EnvironmentVariableInterpolatorError;
-class EnvironmentVariableInterpolator {
-    envVarsRecord;
-    type = manifest_interpolator_1.InterpolatorType.ENVIRONMENT_VARIABLE;
-    POSSIBLE_ENVIRONMENT_VARIABLE = /\$\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g;
-    envVarsToReplace;
-    constructor(envVarsRecord = {}) {
-        this.envVarsRecord = envVarsRecord;
-        this.envVarsToReplace = [];
-    }
-    interpolate(manifest) {
-        this.envVarsToReplace = manifest.environment?.variables ?? [];
-        return (0, yaml_1.parse)(JSON.stringify(manifest), this.environmentVariableReviver);
-    }
-    environmentVariableReviver = (_, value) => {
-        if (!(typeof value == 'string')) {
-            return value;
-        }
-        value = value.replace(this.POSSIBLE_ENVIRONMENT_VARIABLE, (original, envVarName) => {
-            if (!this.envVarsToReplace.includes(envVarName)) {
-                return original;
-            }
-            const envVar = this.envVarsRecord[envVarName];
-            if (envVar === undefined) {
-                throw new EnvironmentVariableInterpolatorError(text_1.errors.schema.missingEnvironmentVariable(envVarName));
-            }
-            Sentry.captureMessage('replaced environment variable');
-            return envVar;
-        });
-        return value;
-    };
-}
-exports.EnvironmentVariableInterpolator = EnvironmentVariableInterpolator;