@intelligems/sst 2.49.6-ig.2 → 2.49.6-ig.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/package.json.bak +1 -1
- package/runtime/handlers/node.js +24 -13
package/package.json
CHANGED
package/package.json.bak
CHANGED
package/runtime/handlers/node.js
CHANGED
|
@@ -65,26 +65,36 @@ export const useNodeHandler = () => {
|
|
|
65
65
|
const monoBundleDir = path.join(project.paths.root, ".mono-build");
|
|
66
66
|
const monoBundlePath = path.join(monoBundleDir, "index.mjs");
|
|
67
67
|
const monoBundleExists = fsSync.existsSync(monoBundlePath);
|
|
68
|
-
console.log(`[MONO-BUNDLE] mode=${input.mode}, exists=${monoBundleExists}, handler=${input.props.handler}`);
|
|
69
68
|
if (input.mode === "start" && monoBundleExists) {
|
|
70
|
-
|
|
71
|
-
Logger.debug("Using mono-bundle for dev mode:", monoBundlePath);
|
|
69
|
+
Colors.line(Colors.prefix, Colors.dim.bold("MonoBundle"), Colors.dim(`mode=${input.mode}, exists=${monoBundleExists}, handler=${input.props.handler}`));
|
|
72
70
|
// Symlink node_modules to mono-bundle dir for external dependencies
|
|
73
|
-
//
|
|
74
|
-
// handler-functions.ts lives in web/node-backend/src/, so start from there
|
|
71
|
+
// Only create if symlink doesn't exist or points to wrong location (avoid redundant I/O)
|
|
75
72
|
const handlerFunctionsDir = path.join(project.paths.root, "web/node-backend/src");
|
|
76
73
|
const root = await findAbove(handlerFunctionsDir, "package.json");
|
|
77
74
|
if (root) {
|
|
78
|
-
const sourceNodeModules = path.
|
|
75
|
+
const sourceNodeModules = path.resolve(root, "node_modules");
|
|
79
76
|
const monoBundleNodeModules = path.join(monoBundleDir, "node_modules");
|
|
80
77
|
try {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
const existingTarget = await fs.readlink(monoBundleNodeModules);
|
|
79
|
+
if (existingTarget === sourceNodeModules) {
|
|
80
|
+
// Symlink already correct, skip
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
// Symlink points to wrong location, recreate
|
|
84
|
+
await fs.rm(monoBundleNodeModules, { recursive: true, force: true });
|
|
85
|
+
await fs.symlink(sourceNodeModules, monoBundleNodeModules, "dir");
|
|
86
|
+
Logger.debug("Symlinked node_modules for mono-bundle from:", sourceNodeModules);
|
|
87
|
+
}
|
|
85
88
|
}
|
|
86
|
-
catch
|
|
87
|
-
|
|
89
|
+
catch {
|
|
90
|
+
// Symlink doesn't exist, create it
|
|
91
|
+
try {
|
|
92
|
+
await fs.symlink(sourceNodeModules, monoBundleNodeModules, "dir");
|
|
93
|
+
Logger.debug("Symlinked node_modules for mono-bundle from:", sourceNodeModules);
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
Logger.debug("Failed to symlink node_modules for mono-bundle:", err);
|
|
97
|
+
}
|
|
88
98
|
}
|
|
89
99
|
}
|
|
90
100
|
return {
|
|
@@ -140,7 +150,8 @@ export const useNodeHandler = () => {
|
|
|
140
150
|
try {
|
|
141
151
|
await fs.symlink(path.resolve(dir), path.resolve(path.join(input.out, "node_modules")), "dir");
|
|
142
152
|
}
|
|
143
|
-
catch {
|
|
153
|
+
catch {
|
|
154
|
+
}
|
|
144
155
|
}
|
|
145
156
|
// Rebuilt using existing esbuild context
|
|
146
157
|
let ctx = rebuildCache[input.functionID]?.ctx;
|