@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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "@intelligems/sst",
4
- "version": "2.49.6-ig.2",
4
+ "version": "2.49.6-ig.3",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
package/package.json.bak CHANGED
@@ -5,7 +5,7 @@
5
5
  },
6
6
  "sideEffects": false,
7
7
  "name": "@intelligems/sst",
8
- "version": "2.49.6-ig.2",
8
+ "version": "2.49.6-ig.3",
9
9
  "bin": {
10
10
  "sst": "cli/sst.js"
11
11
  },
@@ -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
- console.log(`[MONO-BUNDLE] Using mono-bundle for: ${input.props.handler}`);
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
- // Use the same approach as individual builds: find nearest package.json above the handler
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.join(root, "node_modules");
75
+ const sourceNodeModules = path.resolve(root, "node_modules");
79
76
  const monoBundleNodeModules = path.join(monoBundleDir, "node_modules");
80
77
  try {
81
- // Remove existing node_modules in mono-build (might be stale from deploy build)
82
- await fs.rm(monoBundleNodeModules, { recursive: true, force: true });
83
- await fs.symlink(path.resolve(sourceNodeModules), monoBundleNodeModules, "dir");
84
- Logger.debug("Symlinked node_modules for mono-bundle from:", sourceNodeModules);
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 (err) {
87
- Logger.debug("Failed to symlink node_modules for mono-bundle:", err);
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;