npm package diff

Package: @forge/tunnel

Versions: 5.5.0-next.13 - 5.5.0-next.14

File: package/out/servers/dev-server.js

Index: package/out/servers/dev-server.js
===================================================================
--- package/out/servers/dev-server.js
+++ package/out/servers/dev-server.js
@@ -1,14 +1,15 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.LocalDevelopmentServer = exports.stopServer = void 0;
 const tslib_1 = require("tslib");
+const path_1 = tslib_1.__importDefault(require("path"));
 const express_1 = tslib_1.__importDefault(require("express"));
 const bundler_1 = require("@forge/bundler");
 const cli_shared_1 = require("@forge/cli-shared");
 const runtime_1 = require("@forge/runtime");
-const util_1 = require("../util");
 const bundler_2 = require("@forge/bundler");
+const util_1 = require("../util");
 async function stopServer(server) {
     if (!server) {
         return;
     }
@@ -50,20 +51,23 @@
     async stop() {
         await stopServer(this.httpServer);
     }
     async compileAndWatch({ onBuildWillStart, onBuildFinished }, tunnelOptions = cli_shared_1.defaultNoDebugTunnelOptions) {
+        const isNodeJsRuntime = (await this.configFile.runtimeType()) === cli_shared_1.RuntimeType.nodejs;
+        const outputDir = isNodeJsRuntime && tunnelOptions.debug ? path_1.default.resolve(cli_shared_1.TUNNEL_BUNDLE_DIRECTORY) : (0, cli_shared_1.tmpDir)('tunnel');
         const handlers = await this.configFile.getAppHandlers();
         const entryPoints = (0, bundler_1.getEntryPoints)(handlers);
         if (!entryPoints.length) {
-            return { output: {} };
+            return { outputDir };
         }
-        const getConfig = (await this.configFile.runtimeType()) === cli_shared_1.RuntimeType.nodejs
+        const getConfig = isNodeJsRuntime
             ? (0, bundler_2.getNodeRuntimeBuildConfig)((0, bundler_1.getWrapperProvider)({ fileSystemReader: this.fileSystemReader }))
             : bundler_2.getSandboxedRuntimeBuildConfig;
         const config = getConfig(entryPoints, {
             isWatchMode: true,
             isDebugMode: tunnelOptions.debug,
-            appDirectory: process.cwd()
+            appDirectory: process.cwd(),
+            outputDir
         });
         const compiler = (0, bundler_2.getCompiler)(config);
         let isFirstRun = true;
         compiler.hooks.watchRun.tapAsync('watchRun', async (_, watchRunCallback) => {
@@ -76,14 +80,13 @@
             compiler.watch({ poll: 1000 }, async (compilerError, stats) => {
                 try {
                     (0, bundler_2.handleWebpackCompilationResult)(this.logger, compilerError, stats);
                     this.logger.info(cli_shared_1.LogColor.trace(cli_shared_1.Text.tunnel.functionsBundlingSucceeded));
-                    const bundle = (0, bundler_2.getInMemoryBundle)(config);
                     if (!isFirstRun) {
-                        await onBuildFinished(null, bundle);
+                        await onBuildFinished(null, { outputDir });
                     }
                     isFirstRun = false;
-                    resolve(bundle);
+                    resolve({ outputDir });
                 }
                 catch (err) {
                     await onBuildFinished(err);
                     isFirstRun = false;