sst 2.11.6 → 2.11.7
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/project.js +1 -1
- package/sst.mjs +16 -3
- package/stacks/build.d.ts +1 -1
- package/stacks/build.js +13 -2
package/package.json
CHANGED
package/project.js
CHANGED
|
@@ -40,7 +40,7 @@ export async function initProject(globals) {
|
|
|
40
40
|
if (!fsSync.existsSync(file))
|
|
41
41
|
continue;
|
|
42
42
|
// Logger.debug("found sst config");
|
|
43
|
-
const [metafile, config] = await load(file);
|
|
43
|
+
const [metafile, config] = await load(file, true);
|
|
44
44
|
// Logger.debug("loaded sst config");
|
|
45
45
|
return [metafile, config];
|
|
46
46
|
}
|
package/sst.mjs
CHANGED
|
@@ -239,7 +239,7 @@ var init_fs = __esm({
|
|
|
239
239
|
import esbuild from "esbuild";
|
|
240
240
|
import fs3 from "fs/promises";
|
|
241
241
|
import path3 from "path";
|
|
242
|
-
async function load(input) {
|
|
242
|
+
async function load(input, shallow) {
|
|
243
243
|
const parsed = path3.parse(input);
|
|
244
244
|
const root = await findAbove(input, "package.json");
|
|
245
245
|
if (!root)
|
|
@@ -248,6 +248,12 @@ async function load(input) {
|
|
|
248
248
|
const pkg = JSON.parse(
|
|
249
249
|
await fs3.readFile(path3.join(root, "package.json")).then((x) => x.toString())
|
|
250
250
|
);
|
|
251
|
+
let contents = await fs3.readFile(input).then((x) => x.toString());
|
|
252
|
+
if (shallow)
|
|
253
|
+
contents = contents.replaceAll(
|
|
254
|
+
/stacks\(.*?\)\s*{[\s\S]*?}\s*[,;]/gs,
|
|
255
|
+
"stacks() {},"
|
|
256
|
+
);
|
|
251
257
|
try {
|
|
252
258
|
const result = await esbuild.build({
|
|
253
259
|
keepNames: true,
|
|
@@ -258,6 +264,9 @@ async function load(input) {
|
|
|
258
264
|
metafile: true,
|
|
259
265
|
format: "esm",
|
|
260
266
|
logLevel: "silent",
|
|
267
|
+
define: {
|
|
268
|
+
"process.env.IS_SHALLOW": shallow ? "true" : "false"
|
|
269
|
+
},
|
|
261
270
|
external: [
|
|
262
271
|
"aws-cdk-lib",
|
|
263
272
|
"sst",
|
|
@@ -275,7 +284,11 @@ async function load(input) {
|
|
|
275
284
|
`const require = topLevelCreateRequire(import.meta.url);`
|
|
276
285
|
].join("")
|
|
277
286
|
},
|
|
278
|
-
|
|
287
|
+
stdin: {
|
|
288
|
+
contents,
|
|
289
|
+
loader: "ts",
|
|
290
|
+
resolveDir: path3.dirname(input)
|
|
291
|
+
}
|
|
279
292
|
});
|
|
280
293
|
const mod = await dynamicImport(outfile);
|
|
281
294
|
await fs3.rm(outfile, {
|
|
@@ -343,7 +356,7 @@ async function initProject(globals) {
|
|
|
343
356
|
file = path4.join(root, "sst" + ext);
|
|
344
357
|
if (!fsSync.existsSync(file))
|
|
345
358
|
continue;
|
|
346
|
-
const [metafile2, config2] = await load(file);
|
|
359
|
+
const [metafile2, config2] = await load(file, true);
|
|
347
360
|
return [metafile2, config2];
|
|
348
361
|
}
|
|
349
362
|
throw new VisibleError(
|
package/stacks/build.d.ts
CHANGED
package/stacks/build.js
CHANGED
|
@@ -4,13 +4,16 @@ import path from "path";
|
|
|
4
4
|
import { dynamicImport } from "../util/module.js";
|
|
5
5
|
import { findAbove } from "../util/fs.js";
|
|
6
6
|
import { VisibleError } from "../error.js";
|
|
7
|
-
export async function load(input) {
|
|
7
|
+
export async function load(input, shallow) {
|
|
8
8
|
const parsed = path.parse(input);
|
|
9
9
|
const root = await findAbove(input, "package.json");
|
|
10
10
|
if (!root)
|
|
11
11
|
throw new VisibleError("Could not find a package.json file");
|
|
12
12
|
const outfile = path.join(parsed.dir, `.${parsed.name}.${Date.now()}.mjs`);
|
|
13
13
|
const pkg = JSON.parse(await fs.readFile(path.join(root, "package.json")).then((x) => x.toString()));
|
|
14
|
+
let contents = await fs.readFile(input).then((x) => x.toString());
|
|
15
|
+
if (shallow)
|
|
16
|
+
contents = contents.replaceAll(/stacks\(.*?\)\s*{[\s\S]*?}\s*[,;]/gs, "stacks() {},");
|
|
14
17
|
try {
|
|
15
18
|
// Logger.debug("running esbuild on", input);
|
|
16
19
|
const result = await esbuild.build({
|
|
@@ -22,6 +25,9 @@ export async function load(input) {
|
|
|
22
25
|
metafile: true,
|
|
23
26
|
format: "esm",
|
|
24
27
|
logLevel: "silent",
|
|
28
|
+
define: {
|
|
29
|
+
"process.env.IS_SHALLOW": shallow ? "true" : "false",
|
|
30
|
+
},
|
|
25
31
|
external: [
|
|
26
32
|
"aws-cdk-lib",
|
|
27
33
|
"sst",
|
|
@@ -42,7 +48,12 @@ export async function load(input) {
|
|
|
42
48
|
// The entry can have any file name (ie. "stacks/anything.ts"). We want the
|
|
43
49
|
// build output to be always named "lib/index.js". This allow us to always
|
|
44
50
|
// import from "buildDir" without needing to pass "anything" around.
|
|
45
|
-
|
|
51
|
+
stdin: {
|
|
52
|
+
contents,
|
|
53
|
+
loader: "ts",
|
|
54
|
+
resolveDir: path.dirname(input),
|
|
55
|
+
},
|
|
56
|
+
// entryPoints: [input],
|
|
46
57
|
});
|
|
47
58
|
// Logger.debug("built", input);
|
|
48
59
|
const mod = await dynamicImport(outfile);
|