npm package diff

Package: @forge/tunnel

Versions: 5.3.3-next.0-experimental-10722bc - 5.5.0-next.13

File: package/out/servers/resource-tunnel-server.js

Index: package/out/servers/resource-tunnel-server.js
===================================================================
--- package/out/servers/resource-tunnel-server.js
+++ package/out/servers/resource-tunnel-server.js
@@ -34,9 +34,9 @@
     }
     getCspHeader = (existingCsp) => new csp_1.CSPInjectionService()
         .getInjectableCSP({
         existingCSPDetails: existingCsp,
-        microsEnv: (0, cli_shared_1.getEnvironment)(cli_shared_1.CDNEnvironments),
+        microsEnv: (0, cli_shared_1.getEnvironmentConfig)(cli_shared_1.CDNEnvironments),
         tunnelCSPReporterUri: `http://localhost:${this.cspReporterServerPort}`
     })
         .join('; ');
     injectGlobalBridgeScript = (htmlContent) => new cli_shared_1.BridgeScriptService().injectBridgeCore(htmlContent, () => {
@@ -55,6 +55,20 @@
         const cspDetails = new csp_1.CSPProcessingService({ info: () => { } }).getCspDetails(htmlContentWithBridgeScript, ResourceTunnelServer.transformPermissionsWithRemotes(permissions, remotes));
         res.setHeader('Content-Security-Policy', this.getCspHeader(cspDetails));
         return htmlContentWithBridgeScript;
     });
+    getI18nResourcesMiddleware = (i18nConfig) => {
+        const i18nResourcesPathRegex = /^\/__LOCALES__\/(.+)\.json$/i;
+        const i18nResourceFileAccessor = new cli_shared_1.I18nResourceBundlingService().createFileAccessor(i18nConfig);
+        return async (req, resp, next) => {
+            const locale = i18nResourcesPathRegex.exec(req.path)?.[1];
+            if (!locale)
+                return next();
+            const file = await i18nResourceFileAccessor(locale);
+            if (!file)
+                return next();
+            resp.setHeader('Content-Type', 'application/json');
+            resp.status(200).send(file);
+        };
+    };
 }
 exports.ResourceTunnelServer = ResourceTunnelServer;