sst 2.24.2 → 2.24.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/runtime/handlers/node.js +47 -56
- package/stacks/build.js +2 -0
package/package.json
CHANGED
package/runtime/handlers/node.js
CHANGED
|
@@ -112,68 +112,59 @@ export const useNodeHandler = Context.memo(async () => {
|
|
|
112
112
|
catch { }
|
|
113
113
|
}
|
|
114
114
|
// Rebuilt using existing esbuild context
|
|
115
|
-
|
|
116
|
-
if (exists) {
|
|
117
|
-
const result = await exists.ctx.rebuild();
|
|
118
|
-
rebuildCache[input.functionID] = {
|
|
119
|
-
ctx: exists.ctx,
|
|
120
|
-
result,
|
|
121
|
-
};
|
|
122
|
-
return {
|
|
123
|
-
type: "success",
|
|
124
|
-
handler,
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
const { external, ...override } = nodejs.esbuild || {};
|
|
115
|
+
let ctx = rebuildCache[input.functionID]?.ctx;
|
|
128
116
|
const forceExternal = [
|
|
129
117
|
"sharp",
|
|
130
118
|
"pg-native",
|
|
131
119
|
...(isESM || input.props.runtime === "nodejs18.x" ? [] : ["aws-sdk"]),
|
|
132
120
|
];
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
121
|
+
const { external, ...override } = nodejs.esbuild || {};
|
|
122
|
+
if (!ctx) {
|
|
123
|
+
const options = {
|
|
124
|
+
entryPoints: [file],
|
|
125
|
+
platform: "node",
|
|
126
|
+
external: [
|
|
127
|
+
...forceExternal,
|
|
128
|
+
...(nodejs.install || []),
|
|
129
|
+
...(external || []),
|
|
130
|
+
],
|
|
131
|
+
loader: nodejs.loader,
|
|
132
|
+
keepNames: true,
|
|
133
|
+
bundle: true,
|
|
134
|
+
logLevel: "silent",
|
|
135
|
+
metafile: true,
|
|
136
|
+
...(isESM
|
|
137
|
+
? {
|
|
138
|
+
format: "esm",
|
|
139
|
+
target: "esnext",
|
|
140
|
+
mainFields: ["module", "main"],
|
|
141
|
+
banner: {
|
|
142
|
+
js: [
|
|
143
|
+
`import { createRequire as topLevelCreateRequire } from 'module';`,
|
|
144
|
+
`const require = topLevelCreateRequire(import.meta.url);`,
|
|
145
|
+
`import { fileURLToPath as topLevelFileUrlToPath, URL as topLevelURL } from "url"`,
|
|
146
|
+
`const __dirname = topLevelFileUrlToPath(new topLevelURL(".", import.meta.url))`,
|
|
147
|
+
nodejs.banner || "",
|
|
148
|
+
].join("\n"),
|
|
149
|
+
},
|
|
150
|
+
}
|
|
151
|
+
: {
|
|
152
|
+
format: "cjs",
|
|
153
|
+
target: "node14",
|
|
154
|
+
banner: nodejs.banner
|
|
155
|
+
? {
|
|
156
|
+
js: nodejs.banner,
|
|
157
|
+
}
|
|
158
|
+
: undefined,
|
|
159
|
+
}),
|
|
160
|
+
outfile: target,
|
|
161
|
+
sourcemap: input.mode === "start" ? "linked" : nodejs.sourcemap,
|
|
162
|
+
minify: nodejs.minify,
|
|
163
|
+
...override,
|
|
164
|
+
};
|
|
165
|
+
ctx = await esbuild.context(options);
|
|
166
|
+
}
|
|
175
167
|
try {
|
|
176
|
-
const ctx = await esbuild.context(options);
|
|
177
168
|
const result = await ctx.rebuild();
|
|
178
169
|
// Install node_modules
|
|
179
170
|
const installPackages = [
|
package/stacks/build.js
CHANGED