sst 2.49.4 → 2.49.6

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/credentials.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import path from "path";
2
+ import { fileURLToPath, pathToFileURL } from "url";
2
3
  import { fromNodeProviderChain } from "@aws-sdk/credential-providers";
3
4
  import { GetCallerIdentityCommand, STSClient } from "@aws-sdk/client-sts";
4
5
  import { Logger } from "./logger.js";
@@ -121,9 +122,9 @@ export function useAWSClient(client, force = false) {
121
122
  }
122
123
  export const useAWSProvider = lazy(async () => {
123
124
  const cdkToolkitUrl = await import.meta.resolve("@aws-cdk/toolkit-lib");
124
- const cdkToolkitPath = new URL(cdkToolkitUrl).pathname;
125
- const { SdkProvider } = await import(path.resolve(cdkToolkitPath, "..", "api", "aws-auth", "sdk-provider.js"));
126
- const { IoHelper } = await import(path.resolve(cdkToolkitPath, "..", "api", "io", "private", "io-helper.js"));
125
+ const cdkToolkitPath = fileURLToPath(cdkToolkitUrl);
126
+ const { SdkProvider } = await import(pathToFileURL(path.resolve(cdkToolkitPath, "..", "api", "aws-auth", "sdk-provider.js")).href);
127
+ const { IoHelper } = await import(pathToFileURL(path.resolve(cdkToolkitPath, "..", "api", "io", "private", "io-helper.js")).href);
127
128
  const project = useProject();
128
129
  return new SdkProvider(useAWSCredentialsProvider(), project.config.region, {
129
130
  ioHelper: IoHelper.fromActionAwareIoHost({
package/iot.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { IoTClient, DescribeEndpointCommand } from "@aws-sdk/client-iot";
2
2
  import { useAWSClient, useAWSCredentials } from "./credentials.js";
3
3
  import { VisibleError } from "./error.js";
4
+ import { lazy } from "./util/lazy.js";
5
+ import { Logger } from "./logger.js";
4
6
  export const useIOTEndpoint = lazy(async () => {
5
7
  const iot = useAWSClient(IoTClient);
6
8
  Logger.debug("Getting IoT endpoint");
@@ -15,10 +17,8 @@ export const useIOTEndpoint = lazy(async () => {
15
17
  import iot from "aws-iot-device-sdk";
16
18
  import { useBus } from "./bus.js";
17
19
  import { useProject } from "./project.js";
18
- import { Logger } from "./logger.js";
19
20
  import { useBootstrap } from "./bootstrap.js";
20
21
  import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
21
- import { lazy } from "./util/lazy.js";
22
22
  export const useIOT = lazy(async () => {
23
23
  const bus = useBus();
24
24
  const endpoint = await useIOTEndpoint();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.49.4",
4
+ "version": "2.49.6",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
package/package.json.bak CHANGED
@@ -5,7 +5,7 @@
5
5
  },
6
6
  "sideEffects": false,
7
7
  "name": "sst",
8
- "version": "2.49.4",
8
+ "version": "2.49.6",
9
9
  "bin": {
10
10
  "sst": "cli/sst.js"
11
11
  },
package/stacks/deploy.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import path from "path";
2
+ import { fileURLToPath, pathToFileURL } from "url";
2
3
  import { useBus } from "../bus.js";
3
4
  import { useProject } from "../project.js";
4
5
  import { useAWSClient, useAWSProvider } from "../credentials.js";
@@ -193,9 +194,9 @@ async function addInUseExports(stackArtifact, cfnStack) {
193
194
  }
194
195
  async function createCdkDeployments() {
195
196
  const cdkToolkitUrl = await import.meta.resolve("@aws-cdk/toolkit-lib");
196
- const cdkToolkitPath = new URL(cdkToolkitUrl).pathname;
197
- const { Deployments } = await import(path.resolve(cdkToolkitPath, "..", "api", "deployments", "deployments.js"));
198
- const { IoHelper } = await import(path.resolve(cdkToolkitPath, "..", "api", "io", "private", "io-helper.js"));
197
+ const cdkToolkitPath = fileURLToPath(cdkToolkitUrl);
198
+ const { Deployments } = await import(pathToFileURL(path.resolve(cdkToolkitPath, "..", "api", "deployments", "deployments.js")).href);
199
+ const { IoHelper } = await import(pathToFileURL(path.resolve(cdkToolkitPath, "..", "api", "io", "private", "io-helper.js")).href);
199
200
  const provider = await useAWSProvider();
200
201
  await useAWSProvider();
201
202
  const ioHelper = IoHelper.fromActionAwareIoHost({
package/stacks/synth.js CHANGED
@@ -2,6 +2,7 @@ import { Logger } from "../logger.js";
2
2
  import { useProject } from "../project.js";
3
3
  import { useAWSProvider, useSTSIdentity } from "../credentials.js";
4
4
  import path from "path";
5
+ import { fileURLToPath, pathToFileURL } from "url";
5
6
  import { VisibleError } from "../error.js";
6
7
  import { Semaphore } from "../util/semaphore.js";
7
8
  import { Configuration } from "../util/user-configuration.js";
@@ -11,10 +12,10 @@ export async function synth(opts) {
11
12
  const { App } = await import("../constructs/App.js");
12
13
  const cxapi = await import("@aws-cdk/cx-api");
13
14
  const cdkToolkitUrl = await import.meta.resolve("@aws-cdk/toolkit-lib");
14
- const cdkToolkitPath = new URL(cdkToolkitUrl).pathname;
15
- const { IoHelper } = await import(path.resolve(cdkToolkitPath, "..", "api", "io", "private", "io-helper.js"));
16
- const { PluginHost } = await import(path.resolve(cdkToolkitPath, "..", "api", "plugin", "plugin.js"));
17
- const { provideContextValues } = await import(path.resolve(cdkToolkitPath, "..", "context-providers", "index.js"));
15
+ const cdkToolkitPath = fileURLToPath(cdkToolkitUrl);
16
+ const { IoHelper } = await import(pathToFileURL(path.resolve(cdkToolkitPath, "..", "api", "io", "private", "io-helper.js")).href);
17
+ const { PluginHost } = await import(pathToFileURL(path.resolve(cdkToolkitPath, "..", "api", "plugin", "plugin.js")).href);
18
+ const { provideContextValues } = await import(pathToFileURL(path.resolve(cdkToolkitPath, "..", "context-providers", "index.js")).href);
18
19
  const project = useProject();
19
20
  const cwd = process.cwd();
20
21
  process.chdir(project.paths.root);
@@ -1,16 +1,28 @@
1
- // @ts-nocheck
2
1
  import * as os from "os";
3
2
  import * as fs_path from "path";
4
3
  import * as fs from "fs";
4
+ import { fileURLToPath, pathToFileURL } from "url";
5
5
  export const PROJECT_CONFIG = "cdk.json";
6
6
  export const USER_DEFAULTS = "~/.cdk.json";
7
7
  const CONTEXT_KEY = "context";
8
- const cdkToolkitUrl = await import.meta.resolve("@aws-cdk/toolkit-lib");
9
- const cdkToolkitPath = new URL(cdkToolkitUrl).pathname;
10
- const { ToolkitError } = await import(cdkToolkitPath);
11
- const { Context, PROJECT_CONTEXT } = await import(fs_path.resolve(cdkToolkitPath, "..", "api", "context.js"));
12
- const { Settings } = await import(fs_path.resolve(cdkToolkitPath, "..", "api", "settings.js"));
13
- const { Tags } = await import(fs_path.resolve(cdkToolkitPath, "..", "api", "tags", "index.js"));
8
+ let cdkToolkitPath = "";
9
+ let cdkToolkitUrl = "";
10
+ try {
11
+ cdkToolkitUrl = await import.meta.resolve("@aws-cdk/toolkit-lib");
12
+ cdkToolkitPath = fileURLToPath(cdkToolkitUrl);
13
+ }
14
+ catch (e) {
15
+ // Fallback for test environment where import.meta.resolve is not available
16
+ const module = await import("module");
17
+ const require = module.createRequire(import.meta.url);
18
+ cdkToolkitPath = require.resolve("@aws-cdk/toolkit-lib");
19
+ cdkToolkitUrl = pathToFileURL(cdkToolkitPath).href;
20
+ }
21
+ const { ToolkitError } = await import(cdkToolkitUrl);
22
+ const { Context, PROJECT_CONTEXT } = await import(pathToFileURL(fs_path.resolve(cdkToolkitPath, "..", "api", "context.js")).href);
23
+ const { Settings } = await import(pathToFileURL(fs_path.resolve(cdkToolkitPath, "..", "api", "settings.js"))
24
+ .href);
25
+ const { Tags } = await import(pathToFileURL(fs_path.resolve(cdkToolkitPath, "..", "api", "tags", "index.js")).href);
14
26
  export var Command;
15
27
  (function (Command) {
16
28
  Command["LS"] = "ls";