sst 2.11.6 → 2.11.8
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 +2 -1
- package/project.js +1 -1
- package/sst.mjs +46 -11
- package/stacks/build.d.ts +1 -1
- package/stacks/build.js +45 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sideEffects": false,
|
|
3
3
|
"name": "sst",
|
|
4
|
-
"version": "2.11.
|
|
4
|
+
"version": "2.11.8",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sst": "cli/sst.js"
|
|
7
7
|
},
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"@aws-sdk/smithy-client": "^3.279.0",
|
|
50
50
|
"@babel/core": "^7.0.0-0",
|
|
51
51
|
"@babel/generator": "^7.20.5",
|
|
52
|
+
"@babel/plugin-syntax-typescript": "^7.21.4",
|
|
52
53
|
"@trpc/server": "9.16.0",
|
|
53
54
|
"adm-zip": "^0.5.10",
|
|
54
55
|
"aws-cdk-lib": "2.79.1",
|
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,10 @@ var init_fs = __esm({
|
|
|
239
239
|
import esbuild from "esbuild";
|
|
240
240
|
import fs3 from "fs/promises";
|
|
241
241
|
import path3 from "path";
|
|
242
|
-
|
|
242
|
+
import babel from "@babel/core";
|
|
243
|
+
import generate from "@babel/generator";
|
|
244
|
+
import ts from "@babel/plugin-syntax-typescript";
|
|
245
|
+
async function load(input, shallow) {
|
|
243
246
|
const parsed = path3.parse(input);
|
|
244
247
|
const root = await findAbove(input, "package.json");
|
|
245
248
|
if (!root)
|
|
@@ -252,12 +255,14 @@ async function load(input) {
|
|
|
252
255
|
const result = await esbuild.build({
|
|
253
256
|
keepNames: true,
|
|
254
257
|
bundle: true,
|
|
255
|
-
sourcemap: "inline",
|
|
256
258
|
platform: "node",
|
|
257
259
|
target: "esnext",
|
|
258
260
|
metafile: true,
|
|
259
261
|
format: "esm",
|
|
260
262
|
logLevel: "silent",
|
|
263
|
+
define: {
|
|
264
|
+
"process.env.IS_SHALLOW": shallow ? "true" : "false"
|
|
265
|
+
},
|
|
261
266
|
external: [
|
|
262
267
|
"aws-cdk-lib",
|
|
263
268
|
"sst",
|
|
@@ -267,6 +272,36 @@ async function load(input) {
|
|
|
267
272
|
...pkg.peerDependencies
|
|
268
273
|
})
|
|
269
274
|
],
|
|
275
|
+
plugins: [
|
|
276
|
+
{
|
|
277
|
+
name: "shallow",
|
|
278
|
+
setup(build2) {
|
|
279
|
+
if (!shallow)
|
|
280
|
+
return;
|
|
281
|
+
build2.onLoad({ filter: /.*/ }, async (args) => {
|
|
282
|
+
if (args.path !== input)
|
|
283
|
+
return;
|
|
284
|
+
let contents = await fs3.readFile(args.path).then((x) => x.toString());
|
|
285
|
+
const ast = babel.parse(contents, {
|
|
286
|
+
sourceType: "module",
|
|
287
|
+
plugins: [ts]
|
|
288
|
+
});
|
|
289
|
+
babel.traverse(ast, {
|
|
290
|
+
ObjectMethod(path20) {
|
|
291
|
+
const { key } = path20.node;
|
|
292
|
+
if ("name" in key && key.name === "stacks") {
|
|
293
|
+
path20.remove();
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
return {
|
|
298
|
+
contents: generate.default(ast).code,
|
|
299
|
+
loader: "ts"
|
|
300
|
+
};
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
],
|
|
270
305
|
absWorkingDir: root,
|
|
271
306
|
outfile,
|
|
272
307
|
banner: {
|
|
@@ -343,7 +378,7 @@ async function initProject(globals) {
|
|
|
343
378
|
file = path4.join(root, "sst" + ext);
|
|
344
379
|
if (!fsSync.existsSync(file))
|
|
345
380
|
continue;
|
|
346
|
-
const [metafile2, config2] = await load(file);
|
|
381
|
+
const [metafile2, config2] = await load(file, true);
|
|
347
382
|
return [metafile2, config2];
|
|
348
383
|
}
|
|
349
384
|
throw new VisibleError(
|
|
@@ -6141,15 +6176,15 @@ var pothos_exports = {};
|
|
|
6141
6176
|
__export(pothos_exports, {
|
|
6142
6177
|
Pothos: () => pothos_exports,
|
|
6143
6178
|
extractSchema: () => extractSchema,
|
|
6144
|
-
generate: () =>
|
|
6179
|
+
generate: () => generate2
|
|
6145
6180
|
});
|
|
6146
|
-
import
|
|
6181
|
+
import babel2 from "@babel/core";
|
|
6147
6182
|
import generator from "@babel/generator";
|
|
6148
6183
|
import esbuild3 from "esbuild";
|
|
6149
6184
|
import fs14 from "fs/promises";
|
|
6150
6185
|
import path16 from "path";
|
|
6151
6186
|
import url9 from "url";
|
|
6152
|
-
async function
|
|
6187
|
+
async function generate2(opts) {
|
|
6153
6188
|
const { printSchema, lexicographicSortSchema } = await import("graphql");
|
|
6154
6189
|
const contents = await extractSchema(opts);
|
|
6155
6190
|
const out = path16.join(path16.dirname(opts.schema), "out.mjs");
|
|
@@ -6187,7 +6222,7 @@ async function extractSchema(opts) {
|
|
|
6187
6222
|
]
|
|
6188
6223
|
});
|
|
6189
6224
|
const globalPaths = /* @__PURE__ */ new Set();
|
|
6190
|
-
const transformed =
|
|
6225
|
+
const transformed = babel2.transformSync(result.outputFiles[0].text, {
|
|
6191
6226
|
sourceType: "module",
|
|
6192
6227
|
plugins: [
|
|
6193
6228
|
{
|
|
@@ -6294,7 +6329,7 @@ var init_pothos = __esm({
|
|
|
6294
6329
|
"src/pothos.ts"() {
|
|
6295
6330
|
"use strict";
|
|
6296
6331
|
init_pothos();
|
|
6297
|
-
({ types, template } =
|
|
6332
|
+
({ types, template } = babel2);
|
|
6298
6333
|
dummyResolver = template(
|
|
6299
6334
|
"const %%dummy_resolver%% = { serialize: x => x, parseValue: x => x };"
|
|
6300
6335
|
);
|
|
@@ -6391,7 +6426,7 @@ var init_kysely = __esm({
|
|
|
6391
6426
|
let databases = [];
|
|
6392
6427
|
const bus = useBus();
|
|
6393
6428
|
const logger = Logger.debug.bind(null, "[kysely-codegen]");
|
|
6394
|
-
async function
|
|
6429
|
+
async function generate3(db) {
|
|
6395
6430
|
if (!db.types)
|
|
6396
6431
|
return;
|
|
6397
6432
|
logger("generating types for", db.migratorID);
|
|
@@ -6445,7 +6480,7 @@ var init_kysely = __esm({
|
|
|
6445
6480
|
secretArn: c.data.secretArn
|
|
6446
6481
|
}));
|
|
6447
6482
|
databases.map(
|
|
6448
|
-
(db) =>
|
|
6483
|
+
(db) => generate3(db).catch((err) => {
|
|
6449
6484
|
logger(err);
|
|
6450
6485
|
})
|
|
6451
6486
|
);
|
|
@@ -6458,7 +6493,7 @@ var init_kysely = __esm({
|
|
|
6458
6493
|
);
|
|
6459
6494
|
if (!db)
|
|
6460
6495
|
return;
|
|
6461
|
-
|
|
6496
|
+
generate3(db).catch((err) => {
|
|
6462
6497
|
logger(err);
|
|
6463
6498
|
});
|
|
6464
6499
|
});
|
package/stacks/build.d.ts
CHANGED
package/stacks/build.js
CHANGED
|
@@ -4,7 +4,11 @@ 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
|
-
|
|
7
|
+
import babel from "@babel/core";
|
|
8
|
+
import generate from "@babel/generator";
|
|
9
|
+
// @ts-expect-error
|
|
10
|
+
import ts from "@babel/plugin-syntax-typescript";
|
|
11
|
+
export async function load(input, shallow) {
|
|
8
12
|
const parsed = path.parse(input);
|
|
9
13
|
const root = await findAbove(input, "package.json");
|
|
10
14
|
if (!root)
|
|
@@ -16,12 +20,14 @@ export async function load(input) {
|
|
|
16
20
|
const result = await esbuild.build({
|
|
17
21
|
keepNames: true,
|
|
18
22
|
bundle: true,
|
|
19
|
-
sourcemap: "inline",
|
|
20
23
|
platform: "node",
|
|
21
24
|
target: "esnext",
|
|
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",
|
|
@@ -31,6 +37,38 @@ export async function load(input) {
|
|
|
31
37
|
...pkg.peerDependencies,
|
|
32
38
|
}),
|
|
33
39
|
],
|
|
40
|
+
plugins: [
|
|
41
|
+
{
|
|
42
|
+
name: "shallow",
|
|
43
|
+
setup(build) {
|
|
44
|
+
if (!shallow)
|
|
45
|
+
return;
|
|
46
|
+
build.onLoad({ filter: /.*/ }, async (args) => {
|
|
47
|
+
if (args.path !== input)
|
|
48
|
+
return;
|
|
49
|
+
let contents = await fs
|
|
50
|
+
.readFile(args.path)
|
|
51
|
+
.then((x) => x.toString());
|
|
52
|
+
const ast = babel.parse(contents, {
|
|
53
|
+
sourceType: "module",
|
|
54
|
+
plugins: [ts],
|
|
55
|
+
});
|
|
56
|
+
babel.traverse(ast, {
|
|
57
|
+
ObjectMethod(path) {
|
|
58
|
+
const { key } = path.node;
|
|
59
|
+
if ("name" in key && key.name === "stacks") {
|
|
60
|
+
path.remove();
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
contents: generate.default(ast).code,
|
|
66
|
+
loader: "ts",
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
],
|
|
34
72
|
absWorkingDir: root,
|
|
35
73
|
outfile,
|
|
36
74
|
banner: {
|
|
@@ -42,6 +80,11 @@ export async function load(input) {
|
|
|
42
80
|
// The entry can have any file name (ie. "stacks/anything.ts"). We want the
|
|
43
81
|
// build output to be always named "lib/index.js". This allow us to always
|
|
44
82
|
// import from "buildDir" without needing to pass "anything" around.
|
|
83
|
+
// stdin: {
|
|
84
|
+
// contents,
|
|
85
|
+
// loader: "ts",
|
|
86
|
+
// resolveDir: path.dirname(input),
|
|
87
|
+
// },
|
|
45
88
|
entryPoints: [input],
|
|
46
89
|
});
|
|
47
90
|
// Logger.debug("built", input);
|