cdk-local 0.149.6 → 0.149.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.
@@ -0,0 +1,140 @@
1
+ //#region src/utils/logger.ts
2
+ const colors = {
3
+ reset: "\x1B[0m",
4
+ bright: "\x1B[1m",
5
+ dim: "\x1B[2m",
6
+ red: "\x1B[31m",
7
+ green: "\x1B[32m",
8
+ yellow: "\x1B[33m",
9
+ blue: "\x1B[34m",
10
+ cyan: "\x1B[36m",
11
+ gray: "\x1B[90m"
12
+ };
13
+ function formatTimestamp() {
14
+ return (/* @__PURE__ */ new Date()).toISOString();
15
+ }
16
+ function resolveDefaultUseColors() {
17
+ const noColor = process.env["NO_COLOR"];
18
+ if (noColor !== void 0 && noColor !== "") return false;
19
+ const forceColor = process.env["FORCE_COLOR"];
20
+ if (forceColor !== void 0 && forceColor !== "" && forceColor !== "0" && forceColor !== "false") return true;
21
+ return !!process.stdout.isTTY;
22
+ }
23
+ var ConsoleLogger = class {
24
+ level;
25
+ useColors;
26
+ constructor(level = "info", useColors = resolveDefaultUseColors()) {
27
+ this.level = level;
28
+ this.useColors = useColors;
29
+ }
30
+ shouldLog(level) {
31
+ const levels = [
32
+ "debug",
33
+ "info",
34
+ "warn",
35
+ "error"
36
+ ];
37
+ const currentLevelIndex = levels.indexOf(this.level);
38
+ return levels.indexOf(level) >= currentLevelIndex;
39
+ }
40
+ formatMessage(level, message, ...args) {
41
+ const formattedArgs = args.length > 0 ? " " + args.map((a) => JSON.stringify(a)).join(" ") : "";
42
+ if (this.level === "debug") {
43
+ const timestamp = formatTimestamp();
44
+ const levelStr = level.toUpperCase().padEnd(5);
45
+ if (this.useColors) {
46
+ const levelColor = {
47
+ debug: colors.gray,
48
+ info: colors.blue,
49
+ warn: colors.yellow,
50
+ error: colors.red
51
+ }[level];
52
+ return `${colors.dim}${timestamp}${colors.reset} ${levelColor}${levelStr}${colors.reset} ${message}${formattedArgs}`;
53
+ }
54
+ return `${timestamp} ${levelStr} ${message}${formattedArgs}`;
55
+ }
56
+ if (level === "error") {
57
+ const line = `ERROR: ${message}${formattedArgs}`;
58
+ return this.useColors ? `${colors.red}${line}${colors.reset}` : line;
59
+ }
60
+ if (level === "warn") {
61
+ const line = `WARN: ${message}${formattedArgs}`;
62
+ return this.useColors ? `${colors.yellow}${line}${colors.reset}` : line;
63
+ }
64
+ return `${message}${formattedArgs}`;
65
+ }
66
+ emit(level, formatted) {
67
+ if (process.env["CDKL_LOG_STREAM"] === "stdout") {
68
+ console.log(formatted);
69
+ return;
70
+ }
71
+ if (level === "error") console.error(formatted);
72
+ else if (level === "warn") console.warn(formatted);
73
+ else if (level === "info") console.info(formatted);
74
+ else console.debug(formatted);
75
+ }
76
+ debug(message, ...args) {
77
+ if (this.shouldLog("debug")) this.emit("debug", this.formatMessage("debug", message, ...args));
78
+ }
79
+ info(message, ...args) {
80
+ if (this.shouldLog("info")) this.emit("info", this.formatMessage("info", message, ...args));
81
+ }
82
+ warn(message, ...args) {
83
+ if (this.shouldLog("warn")) this.emit("warn", this.formatMessage("warn", message, ...args));
84
+ }
85
+ error(message, ...args) {
86
+ if (this.shouldLog("error")) this.emit("error", this.formatMessage("error", message, ...args));
87
+ }
88
+ setLevel(level) {
89
+ this.level = level;
90
+ }
91
+ getLevel() {
92
+ return this.level;
93
+ }
94
+ child(prefix) {
95
+ return new ChildLogger(prefix, this.useColors);
96
+ }
97
+ };
98
+ var ChildLogger = class extends ConsoleLogger {
99
+ prefix;
100
+ constructor(prefix, useColors) {
101
+ super("info", useColors);
102
+ this.prefix = prefix;
103
+ }
104
+ syncLevel() {
105
+ if (globalLogger) this.setLevel(globalLogger.getLevel());
106
+ }
107
+ debug(message, ...args) {
108
+ this.syncLevel();
109
+ super.debug(`[${this.prefix}] ${message}`, ...args);
110
+ }
111
+ info(message, ...args) {
112
+ this.syncLevel();
113
+ const msg = this.getLevel() === "debug" ? `[${this.prefix}] ${message}` : message;
114
+ super.info(msg, ...args);
115
+ }
116
+ warn(message, ...args) {
117
+ this.syncLevel();
118
+ const msg = this.getLevel() === "debug" ? `[${this.prefix}] ${message}` : message;
119
+ super.warn(msg, ...args);
120
+ }
121
+ error(message, ...args) {
122
+ this.syncLevel();
123
+ const msg = this.getLevel() === "debug" ? `[${this.prefix}] ${message}` : message;
124
+ super.error(msg, ...args);
125
+ }
126
+ };
127
+ function resolveConfiguredLogLevel() {
128
+ const env = process.env["CDKL_LOG_LEVEL"];
129
+ if (env === "debug" || env === "info" || env === "warn" || env === "error") return env;
130
+ return "info";
131
+ }
132
+ let globalLogger = null;
133
+ function getLogger() {
134
+ if (!globalLogger) globalLogger = new ConsoleLogger(resolveConfiguredLogLevel());
135
+ return globalLogger;
136
+ }
137
+
138
+ //#endregion
139
+ export { resolveConfiguredLogLevel as n, getLogger as t };
140
+ //# sourceMappingURL=logger-CuUAMAnt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger-CuUAMAnt.js","names":[],"sources":["../src/utils/logger.ts"],"mappings":";AA4BA,MAAM,SAAS;CACb,OAAO;CACP,QAAQ;CACR,KAAK;CACL,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CACN,MAAM;CACN,MAAM;AACR;AAEA,SAAS,kBAA0B;CAEjC,wBAAO,IADS,KACP,EAAC,CAAC,YAAY;AACzB;AAuBA,SAAgB,0BAAmC;CACjD,MAAM,UAAU,QAAQ,IAAI;CAC5B,IAAI,YAAY,UAAa,YAAY,IACvC,OAAO;CAET,MAAM,aAAa,QAAQ,IAAI;CAC/B,IACE,eAAe,UACf,eAAe,MACf,eAAe,OACf,eAAe,SAEf,OAAO;CAET,OAAO,CAAC,CAAC,QAAQ,OAAO;AAC1B;AASA,IAAa,gBAAb,MAA6C;CAC3C,AAAQ;CACR,AAAQ;CAER,YAAY,QAAkB,QAAQ,YAAqB,wBAAwB,GAAG;EACpF,KAAK,QAAQ;EACb,KAAK,YAAY;CACnB;CAEA,AAAQ,UAAU,OAA0B;EAC1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,GAAG,MAAuB;EACvD,KAAK,UAAU;EACf,MAAM,MAAM,KAAK,SAAS,MAAM,UAAU,IAAI,KAAK,OAAO,IAAI,YAAY;EAC1E,MAAM,KAAK,KAAK,GAAG,IAAI;CACzB;CAEA,AAAS,MAAM,SAAiB,GAAG,MAAuB;EACxD,KAAK,UAAU;EACf,MAAM,MAAM,KAAK,SAAS,MAAM,UAAU,IAAI,KAAK,OAAO,IAAI,YAAY;EAC1E,MAAM,MAAM,KAAK,GAAG,IAAI;CAC1B;AACF;AAaA,SAAgB,4BAAsC;CACpD,MAAM,MAAM,QAAQ,IAAI;CACxB,IAAI,QAAQ,WAAW,QAAQ,UAAU,QAAQ,UAAU,QAAQ,SACjE,OAAO;CAET,OAAO;AACT;AAEA,IAAI,eAAqC;AAEzC,SAAgB,YAA2B;CACzC,IAAI,CAAC,cACH,eAAe,IAAI,cAAc,0BAA0B,CAAC;CAE9D,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cdk-local",
3
- "version": "0.149.6",
3
+ "version": "0.149.8",
4
4
  "description": "Run your CDK-built app locally — standalone, or against the real AWS resources and data it depends on. A CDK-native alternative to sam local.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,10 +12,6 @@
12
12
  "types": "./dist/index.d.ts",
13
13
  "import": "./dist/index.js"
14
14
  },
15
- "./state-provider": {
16
- "types": "./dist/local/local-state-provider.d.ts",
17
- "import": "./dist/local/local-state-provider.js"
18
- },
19
15
  "./internal": {
20
16
  "types": "./dist/internal.d.ts",
21
17
  "import": "./dist/internal.js"
@@ -112,10 +108,10 @@
112
108
  },
113
109
  "peerDependenciesMeta": {
114
110
  "aws-cdk-lib": {
115
- "optional": false
111
+ "optional": true
116
112
  },
117
113
  "constructs": {
118
- "optional": false
114
+ "optional": true
119
115
  }
120
116
  }
121
117
  }