sst 2.0.0-rc.11 → 2.0.0-rc.13
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/bootstrap.js +3 -3
- package/cache.js +1 -1
- package/cli/commands/bind.js +2 -2
- package/cli/commands/build.js +4 -4
- package/cli/commands/deploy.js +4 -5
- package/cli/commands/dev.js +14 -16
- package/cli/commands/env.js +4 -3
- package/cli/commands/plugins/kysely.js +2 -2
- package/cli/commands/remove.js +4 -5
- package/cli/commands/update.js +4 -2
- package/cli/local/router.d.ts +1 -1
- package/cli/local/router.js +3 -3
- package/cli/local/server.js +3 -3
- package/cli/program.js +1 -1
- package/cli/telemetry/environment.js +1 -1
- package/cli/ui/deploy.js +2 -2
- package/config.js +5 -5
- package/constructs/App.js +1 -1
- package/constructs/AppSyncApi.js +1 -1
- package/constructs/Function.js +2 -2
- package/constructs/Job.js +2 -2
- package/constructs/SsrSite.js +1 -1
- package/constructs/Stack.js +1 -1
- package/constructs/StaticSite.js +1 -1
- package/constructs/deprecated/NextjsSite.js +1 -1
- package/credentials.js +6 -6
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/iot.js +2 -2
- package/logger.js +1 -1
- package/node/api/index.d.ts +2 -0
- package/node/api/index.js +8 -0
- package/package.json +4 -3
- package/project.d.ts +44 -0
- package/{app.js → project.js} +59 -51
- package/runtime/handlers/dotnet.js +1 -1
- package/runtime/handlers/java.js +1 -1
- package/runtime/handlers/node.js +1 -1
- package/runtime/handlers.js +1 -1
- package/runtime/runtime.d.ts +4 -0
- package/runtime/workers.js +4 -0
- package/site-env.js +1 -1
- package/sst.mjs +550 -549
- package/stacks/build.d.ts +1 -1
- package/stacks/build.js +9 -20
- package/stacks/metadata.js +5 -5
- package/stacks/synth.js +4 -4
- package/support/bridge/bridge.mjs +22 -22
- package/support/rds-migrator/index.mjs +22 -22
- package/watcher.js +1 -1
- package/app.d.ts +0 -36
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sst",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.13",
|
|
4
4
|
"bin": {
|
|
5
5
|
"sst": "cli/sst.js"
|
|
6
6
|
},
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"./constructs": "./constructs/index.js",
|
|
18
18
|
"./context": "./context/index.js",
|
|
19
19
|
"./node/*": "./node/*/index.js",
|
|
20
|
+
".": "./index.js",
|
|
20
21
|
"./*": "./*"
|
|
21
22
|
},
|
|
22
23
|
"homepage": "https://sst.dev",
|
|
@@ -68,8 +69,8 @@
|
|
|
68
69
|
"immer": "9",
|
|
69
70
|
"ink": "^3.2.0",
|
|
70
71
|
"ink-spinner": "^4.0.3",
|
|
71
|
-
"kysely": "^0.
|
|
72
|
-
"kysely-codegen": "^0.
|
|
72
|
+
"kysely": "^0.23.3",
|
|
73
|
+
"kysely-codegen": "^0.9.0",
|
|
73
74
|
"kysely-data-api": "^0.1.4",
|
|
74
75
|
"openid-client": "^5.1.8",
|
|
75
76
|
"ora": "^6.1.2",
|
package/project.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Metafile } from "esbuild";
|
|
2
|
+
import { App } from "./constructs/App.js";
|
|
3
|
+
export interface SSTConfig {
|
|
4
|
+
config: (globals: GlobalOptions) => Promise<ConfigOptions> | ConfigOptions;
|
|
5
|
+
stacks: (app: App) => Promise<void> | void;
|
|
6
|
+
}
|
|
7
|
+
export interface ConfigOptions {
|
|
8
|
+
name: string;
|
|
9
|
+
region?: string;
|
|
10
|
+
stage?: string;
|
|
11
|
+
profile?: string;
|
|
12
|
+
ssmPrefix?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const DEFAULTS: {
|
|
15
|
+
readonly stage: undefined;
|
|
16
|
+
readonly ssmPrefix: undefined;
|
|
17
|
+
};
|
|
18
|
+
interface Project {
|
|
19
|
+
config: ConfigOptions & Required<{
|
|
20
|
+
[key in keyof typeof DEFAULTS]: Exclude<ConfigOptions[key], undefined>;
|
|
21
|
+
}>;
|
|
22
|
+
version: string;
|
|
23
|
+
paths: {
|
|
24
|
+
root: string;
|
|
25
|
+
config: string;
|
|
26
|
+
out: string;
|
|
27
|
+
artifacts: string;
|
|
28
|
+
};
|
|
29
|
+
metafile: Metafile;
|
|
30
|
+
stacks: SSTConfig["stacks"];
|
|
31
|
+
}
|
|
32
|
+
export declare const ProjectContext: {
|
|
33
|
+
use(): Project;
|
|
34
|
+
provide(value: Project): void;
|
|
35
|
+
};
|
|
36
|
+
export declare function useProject(): Project;
|
|
37
|
+
interface GlobalOptions {
|
|
38
|
+
profile?: string;
|
|
39
|
+
stage?: string;
|
|
40
|
+
root?: string;
|
|
41
|
+
region?: string;
|
|
42
|
+
}
|
|
43
|
+
export declare function initProject(globals: GlobalOptions): Promise<void>;
|
|
44
|
+
export {};
|
package/{app.js → project.js}
RENAMED
|
@@ -7,10 +7,9 @@ import { Logger } from "./logger.js";
|
|
|
7
7
|
import { Context } from "./context/context.js";
|
|
8
8
|
import { VisibleError } from "./error.js";
|
|
9
9
|
import { blue } from "colorette";
|
|
10
|
-
import { dynamicImport } from "./util/module.js";
|
|
11
10
|
import dotenv from "dotenv";
|
|
11
|
+
import { Stacks } from "./stacks/index.js";
|
|
12
12
|
const DEFAULTS = {
|
|
13
|
-
main: "stacks/index.ts",
|
|
14
13
|
stage: undefined,
|
|
15
14
|
ssmPrefix: undefined,
|
|
16
15
|
};
|
|
@@ -18,65 +17,74 @@ export const ProjectContext = Context.create();
|
|
|
18
17
|
export function useProject() {
|
|
19
18
|
return ProjectContext.use();
|
|
20
19
|
}
|
|
21
|
-
const CONFIG_EXTENSIONS = [
|
|
20
|
+
const CONFIG_EXTENSIONS = [
|
|
21
|
+
".config.ts",
|
|
22
|
+
".config.mts",
|
|
23
|
+
".config.cts",
|
|
24
|
+
".config.cjs",
|
|
25
|
+
".config.mjs",
|
|
26
|
+
".config.js",
|
|
27
|
+
".json",
|
|
28
|
+
];
|
|
22
29
|
export async function initProject(globals) {
|
|
23
30
|
const root = globals.root || (await findRoot());
|
|
24
31
|
const out = path.join(root, ".sst");
|
|
25
32
|
await fs.mkdir(out, {
|
|
26
33
|
recursive: true,
|
|
27
34
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
if (file.endsWith("js")) {
|
|
39
|
-
const fn = await dynamicImport(file);
|
|
40
|
-
return await fn.default(globals);
|
|
41
|
-
}
|
|
42
|
-
if (file.endsWith(".json")) {
|
|
43
|
-
const data = await fs.readFile(file);
|
|
44
|
-
return Object.assign(DEFAULTS, JSON.parse(data.toString("utf8")));
|
|
45
|
-
}
|
|
35
|
+
let file;
|
|
36
|
+
const [metafile, sstConfig] = await (async function () {
|
|
37
|
+
for (const ext of CONFIG_EXTENSIONS) {
|
|
38
|
+
file = path.join(root, "sst" + ext);
|
|
39
|
+
try {
|
|
40
|
+
await fs.access(file);
|
|
46
41
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
42
|
+
catch {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (file.endsWith("js") || file.endsWith("ts")) {
|
|
46
|
+
const [metafile, config] = await Stacks.load(file);
|
|
47
|
+
return [metafile, config];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
throw new VisibleError("Could not found a configuration file", "Make sure one of the following exists", " - sst.config.cjs", " - sst.config.mjs", " - sst.config.js", " - sst.config.ts", " - sst.json");
|
|
51
|
+
})();
|
|
52
|
+
const config = await Promise.resolve(sstConfig.config(globals));
|
|
53
|
+
const stage = config.stage ||
|
|
54
|
+
globals.stage ||
|
|
55
|
+
(await usePersonalStage(out)) ||
|
|
56
|
+
(await promptPersonalStage(out));
|
|
57
|
+
const project = {
|
|
58
|
+
version: await (async () => {
|
|
59
|
+
try {
|
|
60
|
+
const packageJson = JSON.parse(await fs
|
|
61
|
+
.readFile(url.fileURLToPath(new URL("./package.json", import.meta.url)))
|
|
62
|
+
.then((x) => x.toString()));
|
|
63
|
+
return packageJson.version;
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return "unknown";
|
|
67
|
+
}
|
|
68
|
+
})(),
|
|
69
|
+
config: {
|
|
70
|
+
...config,
|
|
71
|
+
stage,
|
|
72
|
+
profile: config.profile || globals.profile,
|
|
73
|
+
region: config.region || globals.region,
|
|
74
|
+
ssmPrefix: config.ssmPrefix || `/sst/${config.name}/${stage}/`,
|
|
75
|
+
},
|
|
76
|
+
stacks: sstConfig.stacks,
|
|
77
|
+
metafile,
|
|
78
|
+
paths: {
|
|
79
|
+
config: file,
|
|
80
|
+
root,
|
|
81
|
+
out,
|
|
82
|
+
artifacts: path.join(out, "artifacts"),
|
|
83
|
+
},
|
|
67
84
|
};
|
|
68
|
-
try {
|
|
69
|
-
const packageJson = JSON.parse(await fs
|
|
70
|
-
.readFile(url.fileURLToPath(new URL("./package.json", import.meta.url)))
|
|
71
|
-
.then((x) => x.toString()));
|
|
72
|
-
project.version = packageJson.version;
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
project.version = "unknown";
|
|
76
|
-
}
|
|
77
85
|
ProjectContext.provide(project);
|
|
78
86
|
dotenv.config({
|
|
79
|
-
path: path.join(project.paths.root, `.env.${project.stage}`),
|
|
87
|
+
path: path.join(project.paths.root, `.env.${project.config.stage}`),
|
|
80
88
|
});
|
|
81
89
|
Logger.debug("Config loaded", project);
|
|
82
90
|
}
|
|
@@ -4,7 +4,7 @@ import { Context } from "../../context/context.js";
|
|
|
4
4
|
import { spawn } from "child_process";
|
|
5
5
|
import { useRuntimeServerConfig } from "../server.js";
|
|
6
6
|
import { findBelow, isChild } from "../../util/fs.js";
|
|
7
|
-
import { useProject } from "../../
|
|
7
|
+
import { useProject } from "../../project.js";
|
|
8
8
|
import { execAsync } from "../../util/process.js";
|
|
9
9
|
import url from "url";
|
|
10
10
|
const FRAMEWORK_MAP = {
|
package/runtime/handlers/java.js
CHANGED
|
@@ -8,7 +8,7 @@ import zipLocal from "zip-local";
|
|
|
8
8
|
import { spawn } from "child_process";
|
|
9
9
|
import { useRuntimeServerConfig } from "../server.js";
|
|
10
10
|
import { existsAsync, findBelow, isChild } from "../../util/fs.js";
|
|
11
|
-
import { useProject } from "../../
|
|
11
|
+
import { useProject } from "../../project.js";
|
|
12
12
|
import { execAsync } from "../../util/process.js";
|
|
13
13
|
import url from "url";
|
|
14
14
|
export const useJavaHandler = Context.memo(() => {
|
package/runtime/handlers/node.js
CHANGED
|
@@ -2,7 +2,7 @@ import path from "path";
|
|
|
2
2
|
import fs from "fs/promises";
|
|
3
3
|
import { exec } from "child_process";
|
|
4
4
|
import fsSync from "fs";
|
|
5
|
-
import { useProject } from "../../
|
|
5
|
+
import { useProject } from "../../project.js";
|
|
6
6
|
import esbuild from "esbuild";
|
|
7
7
|
import url from "url";
|
|
8
8
|
import { Worker } from "worker_threads";
|
package/runtime/handlers.js
CHANGED
|
@@ -4,7 +4,7 @@ import path from "path";
|
|
|
4
4
|
import fs from "fs/promises";
|
|
5
5
|
import { useWatcher } from "../watcher.js";
|
|
6
6
|
import { useBus } from "../bus.js";
|
|
7
|
-
import { useProject } from "../
|
|
7
|
+
import { useProject } from "../project.js";
|
|
8
8
|
import { useFunctions } from "../constructs/Function.js";
|
|
9
9
|
export const useRuntimeHandlers = Context.memo(() => {
|
|
10
10
|
const handlers = [];
|
package/runtime/runtime.d.ts
CHANGED
package/runtime/workers.js
CHANGED
|
@@ -21,6 +21,10 @@ export const useRuntimeWorkers = Context.memo(() => {
|
|
|
21
21
|
});
|
|
22
22
|
const lastRequestId = new Map();
|
|
23
23
|
bus.subscribe("function.invoked", async (evt) => {
|
|
24
|
+
bus.publish("function.ack", {
|
|
25
|
+
functionID: evt.properties.functionID,
|
|
26
|
+
workerID: evt.properties.workerID,
|
|
27
|
+
});
|
|
24
28
|
let worker = workers.get(evt.properties.workerID);
|
|
25
29
|
lastRequestId.set(evt.properties.workerID, evt.properties.context.awsRequestId);
|
|
26
30
|
if (worker)
|
package/site-env.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * as SiteEnv from "./site-env.js";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import { useProject } from "./
|
|
4
|
+
import { useProject } from "./project.js";
|
|
5
5
|
function keysFile() {
|
|
6
6
|
return path.join(useProject().paths.out, "site-environment-keys.jsonl");
|
|
7
7
|
}
|