sst 2.4.1 → 2.4.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.
@@ -6,14 +6,15 @@ import { DatabaseMetadata, EnumCollection, PostgresDialect, MysqlDialect, Serial
6
6
  import { Context } from "../../../context/context.js";
7
7
  import { useBus } from "../../../bus.js";
8
8
  import { Logger } from "../../../logger.js";
9
- import { useAWSClient, } from "../../../credentials.js";
9
+ import { useAWSClient } from "../../../credentials.js";
10
10
  export const useKyselyTypeGenerator = Context.memo(async () => {
11
11
  let databases = [];
12
12
  const bus = useBus();
13
+ const logger = Logger.debug.bind(null, "[kysely-codegen]");
13
14
  async function generate(db) {
14
15
  if (!db.types)
15
16
  return;
16
- Logger.debug("Generating types for", db.migratorID);
17
+ logger("generating types for", db.migratorID);
17
18
  const k = new Kysely({
18
19
  dialect: new DataApiDialect({
19
20
  mode: db.engine.includes("postgres") ? "postgres" : "mysql",
@@ -26,6 +27,7 @@ export const useKyselyTypeGenerator = Context.memo(async () => {
26
27
  }),
27
28
  });
28
29
  const tables = await k.introspection.getTables();
30
+ logger("introspected tables");
29
31
  const metadata = db.engine.includes("postgres")
30
32
  ? tables.map((table) => ({
31
33
  ...table,
@@ -46,6 +48,7 @@ export const useKyselyTypeGenerator = Context.memo(async () => {
46
48
  enumValues: null,
47
49
  })),
48
50
  }));
51
+ logger("generated metadata", metadata.length);
49
52
  const transformer = new Transformer();
50
53
  const Dialect = db.engine.includes("postgres")
51
54
  ? new PostgresDialect()
@@ -55,6 +58,7 @@ export const useKyselyTypeGenerator = Context.memo(async () => {
55
58
  camelCase: db.types.camelCase === true,
56
59
  metadata: new DatabaseMetadata(metadata, new EnumCollection()),
57
60
  });
61
+ logger("transformed nodes", nodes.length);
58
62
  const lastIndex = nodes.length - 1;
59
63
  const last = nodes[lastIndex];
60
64
  nodes[lastIndex] = {
@@ -82,7 +86,9 @@ export const useKyselyTypeGenerator = Context.memo(async () => {
82
86
  defaultDatabaseName: c.data.defaultDatabaseName,
83
87
  secretArn: c.data.secretArn,
84
88
  }));
85
- databases.map((db) => generate(db).catch(() => { }));
89
+ databases.map((db) => generate(db).catch((err) => {
90
+ logger(err);
91
+ }));
86
92
  });
87
93
  bus.subscribe("function.success", async (evt) => {
88
94
  if (!evt.properties.body?.results)
@@ -90,7 +96,9 @@ export const useKyselyTypeGenerator = Context.memo(async () => {
90
96
  const db = databases.find((db) => db.migratorID === evt.properties.functionID);
91
97
  if (!db)
92
98
  return;
93
- generate(db).catch(() => { });
99
+ generate(db).catch((err) => {
100
+ logger(err);
101
+ });
94
102
  });
95
- Logger.debug("Loaded kyseley type generator");
103
+ logger("Loaded kyseley type generator");
96
104
  });
@@ -8,8 +8,11 @@ export interface NextjsSiteResources {
8
8
  }
9
9
  export interface RemixSiteResources {
10
10
  }
11
+ export interface SolidStartSiteResources {
12
+ }
11
13
  export declare const StaticSite: StaticSiteResources;
12
14
  export declare const ReactStaticSite: ReactStaticSiteResources;
13
15
  export declare const ViteStaticSite: ViteStaticSiteResources;
14
16
  export declare const RemixSite: RemixSiteResources;
15
17
  export declare const NextjsSite: NextjsSiteResources;
18
+ export declare const SolidStartSite: SolidStartSiteResources;
@@ -4,13 +4,16 @@ export const ReactStaticSite = createProxy("ReactStaticSite");
4
4
  export const ViteStaticSite = createProxy("ViteStaticSite");
5
5
  export const RemixSite = createProxy("RemixSite");
6
6
  export const NextjsSite = createProxy("NextjsSite");
7
+ export const SolidStartSite = createProxy("SolidStartSite");
7
8
  const staticSiteData = getVariables("StaticSite");
8
9
  const reactSiteData = getVariables("ReactStaticSite");
9
10
  const viteSiteData = getVariables("ViteStaticSite");
10
11
  const nextjsSiteData = getVariables("NextjsSite");
11
12
  const remixSiteData = getVariables("RemixSite");
13
+ const solidStartSiteData = getVariables("SolidStartSite");
12
14
  Object.assign(StaticSite, staticSiteData);
13
15
  Object.assign(ReactStaticSite, reactSiteData);
14
16
  Object.assign(ViteStaticSite, viteSiteData);
15
17
  Object.assign(NextjsSite, nextjsSiteData);
16
18
  Object.assign(RemixSite, remixSiteData);
19
+ Object.assign(SolidStartSite, solidStartSiteData);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sst",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "bin": {
5
5
  "sst": "cli/sst.js"
6
6
  },
@@ -1,5 +1,6 @@
1
1
  import path from "path";
2
2
  import fs from "fs/promises";
3
+ import os from "os";
3
4
  import { useRuntimeHandlers } from "../handlers.js";
4
5
  import { useRuntimeWorkers } from "../workers.js";
5
6
  import { Context } from "../../context/context.js";
@@ -57,7 +58,8 @@ export const useGoHandler = Context.memo(async () => {
57
58
  if (input.mode === "start") {
58
59
  try {
59
60
  const target = path.join(input.out, handlerName);
60
- const result = await execAsync(`go build -ldflags '-s -w' -o '${target}' ./${src}`, {
61
+ const srcPath = os.platform() === "win32" ? src.replaceAll("\\", "\\\\") : src;
62
+ const result = await execAsync(`go build -ldflags "-s -w" -o "${target}" ./${srcPath}`, {
61
63
  cwd: project,
62
64
  env: {
63
65
  ...process.env,
@@ -71,7 +73,8 @@ export const useGoHandler = Context.memo(async () => {
71
73
  if (input.mode === "deploy") {
72
74
  try {
73
75
  const target = path.join(input.out, "bootstrap");
74
- await execAsync(`go build -ldflags '-s -w' -o '${target}' ./${src}`, {
76
+ const srcPath = os.platform() === "win32" ? src.replaceAll("\\", "\\\\") : src;
77
+ await execAsync(`go build -ldflags "-s -w" -o "${target}" ./${srcPath}`, {
75
78
  cwd: project,
76
79
  env: {
77
80
  ...process.env,
@@ -81,8 +84,8 @@ export const useGoHandler = Context.memo(async () => {
81
84
  },
82
85
  });
83
86
  }
84
- catch {
85
- throw new VisibleError("Failed to build");
87
+ catch (ex) {
88
+ throw new VisibleError(`Failed to build ${ex}`);
86
89
  }
87
90
  }
88
91
  return {
package/sst.mjs CHANGED
@@ -3312,7 +3312,7 @@ async function diff(stack, oldTemplate) {
3312
3312
  const pathMap = await buildLogicalToPathMap(stack);
3313
3313
  formatDifferences(stream, diff3, pathMap);
3314
3314
  while (true) {
3315
- if (output[output.length - 1].match(/^\s*$/)) {
3315
+ if (output[output.length - 1]?.match(/^\s*$/)) {
3316
3316
  output.pop();
3317
3317
  } else {
3318
3318
  break;
@@ -4327,6 +4327,7 @@ __export(go_exports, {
4327
4327
  });
4328
4328
  import path9 from "path";
4329
4329
  import fs9 from "fs/promises";
4330
+ import os3 from "os";
4330
4331
  import { spawn as spawn2 } from "child_process";
4331
4332
  async function find(dir, target) {
4332
4333
  if (dir === "/")
@@ -4395,8 +4396,9 @@ var init_go = __esm({
4395
4396
  if (input.mode === "start") {
4396
4397
  try {
4397
4398
  const target = path9.join(input.out, handlerName);
4399
+ const srcPath = os3.platform() === "win32" ? src.replaceAll("\\", "\\\\") : src;
4398
4400
  const result = await execAsync(
4399
- `go build -ldflags '-s -w' -o '${target}' ./${src}`,
4401
+ `go build -ldflags "-s -w" -o "${target}" ./${srcPath}`,
4400
4402
  {
4401
4403
  cwd: project,
4402
4404
  env: {
@@ -4411,17 +4413,21 @@ var init_go = __esm({
4411
4413
  if (input.mode === "deploy") {
4412
4414
  try {
4413
4415
  const target = path9.join(input.out, "bootstrap");
4414
- await execAsync(`go build -ldflags '-s -w' -o '${target}' ./${src}`, {
4415
- cwd: project,
4416
- env: {
4417
- ...process.env,
4418
- CGO_ENABLED: "0",
4419
- GOARCH: input.props.architecture === "arm_64" ? "arm64" : "amd64",
4420
- GOOS: "linux"
4416
+ const srcPath = os3.platform() === "win32" ? src.replaceAll("\\", "\\\\") : src;
4417
+ await execAsync(
4418
+ `go build -ldflags "-s -w" -o "${target}" ./${srcPath}`,
4419
+ {
4420
+ cwd: project,
4421
+ env: {
4422
+ ...process.env,
4423
+ CGO_ENABLED: "0",
4424
+ GOARCH: input.props.architecture === "arm_64" ? "arm64" : "amd64",
4425
+ GOOS: "linux"
4426
+ }
4421
4427
  }
4422
- });
4423
- } catch {
4424
- throw new VisibleError("Failed to build");
4428
+ );
4429
+ } catch (ex) {
4430
+ throw new VisibleError(`Failed to build ${ex}`);
4425
4431
  }
4426
4432
  }
4427
4433
  return {
@@ -4627,7 +4633,7 @@ import path12 from "path";
4627
4633
  import { exec as exec5, spawn as spawn4 } from "child_process";
4628
4634
  import { promisify as promisify3 } from "util";
4629
4635
  import { Runtime } from "aws-cdk-lib/aws-lambda";
4630
- import os3 from "os";
4636
+ import os4 from "os";
4631
4637
  import url6 from "url";
4632
4638
  var execAsync3, RUNTIME_MAP, usePythonHandler;
4633
4639
  var init_python = __esm({
@@ -4676,7 +4682,7 @@ var init_python = __esm({
4676
4682
  const parsed = path12.parse(path12.relative(src, input.handler));
4677
4683
  const target = [...parsed.dir.split(path12.sep), parsed.name].join(".");
4678
4684
  const proc = spawn4(
4679
- os3.platform() === "win32" ? "python.exe" : "python3",
4685
+ os4.platform() === "win32" ? "python.exe" : "python3",
4680
4686
  [
4681
4687
  "-u",
4682
4688
  url6.fileURLToPath(
@@ -4750,7 +4756,7 @@ __export(java_exports, {
4750
4756
  });
4751
4757
  import path13 from "path";
4752
4758
  import fs12 from "fs/promises";
4753
- import os4 from "os";
4759
+ import os5 from "os";
4754
4760
  import zipLocal from "zip-local";
4755
4761
  import { spawn as spawn5 } from "child_process";
4756
4762
  import url7 from "url";
@@ -4795,7 +4801,7 @@ var init_java = __esm({
4795
4801
  url7.fileURLToPath(
4796
4802
  new URL("../../support/java-runtime/release/*", import.meta.url)
4797
4803
  )
4798
- ].join(os4.platform() === "win32" ? ";" : ":"),
4804
+ ].join(os5.platform() === "win32" ? ";" : ":"),
4799
4805
  "com.amazonaws.services.lambda.runtime.api.client.AWSLambda",
4800
4806
  input.handler
4801
4807
  ],
@@ -6301,10 +6307,11 @@ var init_kysely = __esm({
6301
6307
  useKyselyTypeGenerator = Context.memo(async () => {
6302
6308
  let databases = [];
6303
6309
  const bus = useBus();
6310
+ const logger = Logger.debug.bind(null, "[kysely-codegen]");
6304
6311
  async function generate2(db) {
6305
6312
  if (!db.types)
6306
6313
  return;
6307
- Logger.debug("Generating types for", db.migratorID);
6314
+ logger("generating types for", db.migratorID);
6308
6315
  const k = new Kysely({
6309
6316
  dialect: new DataApiDialect({
6310
6317
  mode: db.engine.includes("postgres") ? "postgres" : "mysql",
@@ -6317,6 +6324,7 @@ var init_kysely = __esm({
6317
6324
  })
6318
6325
  });
6319
6326
  const tables = await k.introspection.getTables();
6327
+ logger("introspected tables");
6320
6328
  const metadata3 = db.engine.includes("postgres") ? tables.map((table) => ({
6321
6329
  ...table,
6322
6330
  columns: table.columns.map((column) => {
@@ -6335,6 +6343,7 @@ var init_kysely = __esm({
6335
6343
  enumValues: null
6336
6344
  }))
6337
6345
  }));
6346
+ logger("generated metadata", metadata3.length);
6338
6347
  const transformer = new Transformer();
6339
6348
  const Dialect = db.engine.includes("postgres") ? new PostgresDialect() : new MysqlDialect();
6340
6349
  const nodes = transformer.transform({
@@ -6342,6 +6351,7 @@ var init_kysely = __esm({
6342
6351
  camelCase: db.types.camelCase === true,
6343
6352
  metadata: new DatabaseMetadata(metadata3, new EnumCollection())
6344
6353
  });
6354
+ logger("transformed nodes", nodes.length);
6345
6355
  const lastIndex = nodes.length - 1;
6346
6356
  const last2 = nodes[lastIndex];
6347
6357
  nodes[lastIndex] = {
@@ -6367,8 +6377,11 @@ var init_kysely = __esm({
6367
6377
  defaultDatabaseName: c.data.defaultDatabaseName,
6368
6378
  secretArn: c.data.secretArn
6369
6379
  }));
6370
- databases.map((db) => generate2(db).catch(() => {
6371
- }));
6380
+ databases.map(
6381
+ (db) => generate2(db).catch((err) => {
6382
+ logger(err);
6383
+ })
6384
+ );
6372
6385
  });
6373
6386
  bus.subscribe("function.success", async (evt) => {
6374
6387
  if (!evt.properties.body?.results)
@@ -6378,10 +6391,11 @@ var init_kysely = __esm({
6378
6391
  );
6379
6392
  if (!db)
6380
6393
  return;
6381
- generate2(db).catch(() => {
6394
+ generate2(db).catch((err) => {
6395
+ logger(err);
6382
6396
  });
6383
6397
  });
6384
- Logger.debug("Loaded kyseley type generator");
6398
+ logger("Loaded kyseley type generator");
6385
6399
  });
6386
6400
  }
6387
6401
  });
@@ -7298,8 +7312,8 @@ var bind = (program2) => program2.command(
7298
7312
  Logger2.debug(`Failed to assume ${roleArn}.`, err);
7299
7313
  }
7300
7314
  async function localIamCredentials() {
7301
- const { useAWSCredentials: useAWSCredentials3 } = await Promise.resolve().then(() => (init_credentials(), credentials_exports));
7302
- const credentials = await useAWSCredentials3();
7315
+ const { useAWSCredentials: useAWSCredentials2 } = await Promise.resolve().then(() => (init_credentials(), credentials_exports));
7316
+ const credentials = await useAWSCredentials2();
7303
7317
  return {
7304
7318
  AWS_ACCESS_KEY_ID: credentials.accessKeyId,
7305
7319
  AWS_SECRET_ACCESS_KEY: credentials.secretAccessKey,
package/stacks/diff.js CHANGED
@@ -40,7 +40,7 @@ export async function diff(stack, oldTemplate) {
40
40
  formatDifferences(stream, diff, pathMap);
41
41
  // Remove trailing newline
42
42
  while (true) {
43
- if (output[output.length - 1].match(/^\s*$/)) {
43
+ if (output[output.length - 1]?.match(/^\s*$/)) {
44
44
  output.pop();
45
45
  }
46
46
  else {