@cedarjs/api-server 1.0.0-canary.12464 → 1.0.0-canary.12466

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.
@@ -31,12 +31,12 @@ __export(apiCLIConfigHandler_exports, {
31
31
  handler: () => handler
32
32
  });
33
33
  module.exports = __toCommonJS(apiCLIConfigHandler_exports);
34
- var import_chalk = __toESM(require("chalk"));
34
+ var import_ansis = __toESM(require("ansis"));
35
35
  var import_fastify_web = require("@cedarjs/fastify-web");
36
36
  var import_createServer = require("./createServer");
37
37
  async function handler(options = {}) {
38
38
  const timeStart = Date.now();
39
- console.log(import_chalk.default.dim.italic("Starting API Server..."));
39
+ console.log(import_ansis.default.dim.italic("Starting API Server..."));
40
40
  options.apiRootPath = (0, import_fastify_web.coerceRootPath)(options.apiRootPath ?? "/");
41
41
  const fastify = await (0, import_createServer.createServer)({
42
42
  apiRootPath: options.apiRootPath,
@@ -50,13 +50,13 @@ async function handler(options = {}) {
50
50
  );
51
51
  fastify.log.trace(`Registered plugins
52
52
  ${fastify.printPlugins()}`);
53
- console.log(import_chalk.default.dim.italic("Took " + (Date.now() - timeStart) + " ms"));
53
+ console.log(import_ansis.default.dim.italic("Took " + (Date.now() - timeStart) + " ms"));
54
54
  let address = fastify.listeningOrigin;
55
55
  if (process.env.NODE_ENV !== "production") {
56
56
  address = address.replace(/http:\/\/\[::\]/, "http://localhost");
57
57
  }
58
- const apiServer = import_chalk.default.magenta(`${address}${options.apiRootPath}`);
59
- const graphqlEndpoint = import_chalk.default.magenta(`${apiServer}graphql`);
58
+ const apiServer = import_ansis.default.magenta(`${address}${options.apiRootPath}`);
59
+ const graphqlEndpoint = import_ansis.default.magenta(`${apiServer}graphql`);
60
60
  console.log(`API server listening at ${apiServer}`);
61
61
  console.log(`GraphQL endpoint at ${graphqlEndpoint}`);
62
62
  process?.send?.("ready");
package/dist/bin.js CHANGED
@@ -314,12 +314,12 @@ var init_awsLambdaFastify = __esm({
314
314
  });
315
315
 
316
316
  // src/plugins/lambdaLoader.ts
317
- var import_path2, import_chalk, import_fast_glob, import_lodash, import_project_config3, LAMBDA_FUNCTIONS, setLambdaFunctions, loadFunctionsFromDist, findApiDistFunctions, lambdaRequestHandler;
317
+ var import_path2, import_ansis, import_fast_glob, import_lodash, import_project_config3, LAMBDA_FUNCTIONS, setLambdaFunctions, loadFunctionsFromDist, findApiDistFunctions, lambdaRequestHandler;
318
318
  var init_lambdaLoader = __esm({
319
319
  "src/plugins/lambdaLoader.ts"() {
320
320
  "use strict";
321
321
  import_path2 = __toESM(require("path"));
322
- import_chalk = __toESM(require("chalk"));
322
+ import_ansis = __toESM(require("ansis"));
323
323
  import_fast_glob = __toESM(require("fast-glob"));
324
324
  import_lodash = require("lodash");
325
325
  import_project_config3 = require("@cedarjs/project-config");
@@ -327,7 +327,7 @@ var init_lambdaLoader = __esm({
327
327
  LAMBDA_FUNCTIONS = {};
328
328
  setLambdaFunctions = async (foundFunctions) => {
329
329
  const tsImport = Date.now();
330
- console.log(import_chalk.default.dim.italic("Importing Server Functions... "));
330
+ console.log(import_ansis.default.dim.italic("Importing Server Functions... "));
331
331
  const imports = foundFunctions.map(async (fnPath) => {
332
332
  const ts = Date.now();
333
333
  const routeName = import_path2.default.basename(fnPath).replace(".js", "");
@@ -353,13 +353,13 @@ var init_lambdaLoader = __esm({
353
353
  );
354
354
  }
355
355
  console.log(
356
- import_chalk.default.magenta("/" + routeName),
357
- import_chalk.default.dim.italic(Date.now() - ts + " ms")
356
+ import_ansis.default.magenta("/" + routeName),
357
+ import_ansis.default.dim.italic(Date.now() - ts + " ms")
358
358
  );
359
359
  });
360
360
  await Promise.all(imports);
361
361
  console.log(
362
- import_chalk.default.dim.italic("...Done importing in " + (Date.now() - tsImport) + " ms")
362
+ import_ansis.default.dim.italic("...Done importing in " + (Date.now() - tsImport) + " ms")
363
363
  );
364
364
  };
365
365
  loadFunctionsFromDist = async (options = {}) => {
@@ -571,7 +571,7 @@ async function createServer(options = {}) {
571
571
  );
572
572
  if (import_fs2.default.existsSync(serverConfigPath)) {
573
573
  console.warn(
574
- import_chalk2.default.yellow(
574
+ import_ansis2.default.yellow(
575
575
  [
576
576
  "",
577
577
  `Ignoring \`config\` and \`configureServer\` in api/server.config.js.`,
@@ -630,7 +630,7 @@ async function createServer(options = {}) {
630
630
  });
631
631
  server.addHook("onListen", (done) => {
632
632
  console.log(
633
- `Server listening at ${import_chalk2.default.magenta(
633
+ `Server listening at ${import_ansis2.default.magenta(
634
634
  `${server.listeningOrigin}${apiRootPath}`
635
635
  )}`
636
636
  );
@@ -645,13 +645,13 @@ async function createServer(options = {}) {
645
645
  };
646
646
  return server;
647
647
  }
648
- var import_fs2, import_path3, import_chalk2, import_dotenv_defaults, import_fast_glob3, import_fastify3, import_store4, import_project_config5;
648
+ var import_fs2, import_path3, import_ansis2, import_dotenv_defaults, import_fast_glob3, import_fastify3, import_store4, import_project_config5;
649
649
  var init_createServer = __esm({
650
650
  "src/createServer.ts"() {
651
651
  "use strict";
652
652
  import_fs2 = __toESM(require("fs"));
653
653
  import_path3 = __toESM(require("path"));
654
- import_chalk2 = __toESM(require("chalk"));
654
+ import_ansis2 = __toESM(require("ansis"));
655
655
  import_dotenv_defaults = require("dotenv-defaults");
656
656
  import_fast_glob3 = __toESM(require("fast-glob"));
657
657
  import_fastify3 = __toESM(require("fastify"));
@@ -673,7 +673,7 @@ var init_createServer = __esm({
673
673
  // src/apiCLIConfigHandler.ts
674
674
  async function handler(options = {}) {
675
675
  const timeStart = Date.now();
676
- console.log(import_chalk3.default.dim.italic("Starting API Server..."));
676
+ console.log(import_ansis3.default.dim.italic("Starting API Server..."));
677
677
  options.apiRootPath = (0, import_fastify_web.coerceRootPath)(options.apiRootPath ?? "/");
678
678
  const fastify2 = await createServer({
679
679
  apiRootPath: options.apiRootPath,
@@ -687,22 +687,22 @@ async function handler(options = {}) {
687
687
  );
688
688
  fastify2.log.trace(`Registered plugins
689
689
  ${fastify2.printPlugins()}`);
690
- console.log(import_chalk3.default.dim.italic("Took " + (Date.now() - timeStart) + " ms"));
690
+ console.log(import_ansis3.default.dim.italic("Took " + (Date.now() - timeStart) + " ms"));
691
691
  let address = fastify2.listeningOrigin;
692
692
  if (process.env.NODE_ENV !== "production") {
693
693
  address = address.replace(/http:\/\/\[::\]/, "http://localhost");
694
694
  }
695
- const apiServer = import_chalk3.default.magenta(`${address}${options.apiRootPath}`);
696
- const graphqlEndpoint = import_chalk3.default.magenta(`${apiServer}graphql`);
695
+ const apiServer = import_ansis3.default.magenta(`${address}${options.apiRootPath}`);
696
+ const graphqlEndpoint = import_ansis3.default.magenta(`${apiServer}graphql`);
697
697
  console.log(`API server listening at ${apiServer}`);
698
698
  console.log(`GraphQL endpoint at ${graphqlEndpoint}`);
699
699
  process?.send?.("ready");
700
700
  }
701
- var import_chalk3, import_fastify_web;
701
+ var import_ansis3, import_fastify_web;
702
702
  var init_apiCLIConfigHandler = __esm({
703
703
  "src/apiCLIConfigHandler.ts"() {
704
704
  "use strict";
705
- import_chalk3 = __toESM(require("chalk"));
705
+ import_ansis3 = __toESM(require("ansis"));
706
706
  import_fastify_web = require("@cedarjs/fastify-web");
707
707
  init_createServer();
708
708
  }
@@ -711,7 +711,7 @@ var init_apiCLIConfigHandler = __esm({
711
711
  // src/bothCLIConfigHandler.ts
712
712
  async function handler2(options) {
713
713
  const timeStart = Date.now();
714
- console.log(import_chalk4.default.dim.italic("Starting API and Web Servers..."));
714
+ console.log(import_ansis4.default.dim.italic("Starting API and Web Servers..."));
715
715
  options.webHost ??= getWebHost();
716
716
  options.webPort ??= getWebPort();
717
717
  options.apiHost ??= getAPIHost();
@@ -755,12 +755,12 @@ ${webFastify.printPlugins()}`);
755
755
  );
756
756
  apiFastify.log.trace(`Registered plugins
757
757
  ${apiFastify.printPlugins()}`);
758
- console.log(import_chalk4.default.dim.italic("Took " + (Date.now() - timeStart) + " ms"));
759
- const webServer = import_chalk4.default.green(webFastify.listeningOrigin);
760
- const apiServer = import_chalk4.default.magenta(
758
+ console.log(import_ansis4.default.dim.italic("Took " + (Date.now() - timeStart) + " ms"));
759
+ const webServer = import_ansis4.default.green(webFastify.listeningOrigin);
760
+ const apiServer = import_ansis4.default.magenta(
761
761
  `${apiFastify.listeningOrigin}${options.apiRootPath}`
762
762
  );
763
- const graphqlEndpoint = import_chalk4.default.magenta(`${apiServer}graphql`);
763
+ const graphqlEndpoint = import_ansis4.default.magenta(`${apiServer}graphql`);
764
764
  console.log(`Web server listening at ${webServer}`);
765
765
  console.log(`API server listening at ${apiServer}`);
766
766
  console.log(`GraphQL endpoint at ${graphqlEndpoint}`);
@@ -774,11 +774,11 @@ function getListenTextResolver(side) {
774
774
  return `${side} server listening at ${address}`;
775
775
  };
776
776
  }
777
- var import_chalk4, import_fastify_web2;
777
+ var import_ansis4, import_fastify_web2;
778
778
  var init_bothCLIConfigHandler = __esm({
779
779
  "src/bothCLIConfigHandler.ts"() {
780
780
  "use strict";
781
- import_chalk4 = __toESM(require("chalk"));
781
+ import_ansis4 = __toESM(require("ansis"));
782
782
  import_fastify_web2 = require("@cedarjs/fastify-web");
783
783
  init_cliHelpers();
784
784
  init_createServer();
@@ -31,14 +31,14 @@ __export(bothCLIConfigHandler_exports, {
31
31
  handler: () => handler
32
32
  });
33
33
  module.exports = __toCommonJS(bothCLIConfigHandler_exports);
34
- var import_chalk = __toESM(require("chalk"));
34
+ var import_ansis = __toESM(require("ansis"));
35
35
  var import_fastify_web = require("@cedarjs/fastify-web");
36
36
  var import_cliHelpers = require("./cliHelpers");
37
37
  var import_createServer = require("./createServer");
38
38
  var import_fastify = __toESM(require("./fastify"));
39
39
  async function handler(options) {
40
40
  const timeStart = Date.now();
41
- console.log(import_chalk.default.dim.italic("Starting API and Web Servers..."));
41
+ console.log(import_ansis.default.dim.italic("Starting API and Web Servers..."));
42
42
  options.webHost ??= (0, import_cliHelpers.getWebHost)();
43
43
  options.webPort ??= (0, import_cliHelpers.getWebPort)();
44
44
  options.apiHost ??= (0, import_cliHelpers.getAPIHost)();
@@ -82,12 +82,12 @@ ${webFastify.printPlugins()}`);
82
82
  );
83
83
  apiFastify.log.trace(`Registered plugins
84
84
  ${apiFastify.printPlugins()}`);
85
- console.log(import_chalk.default.dim.italic("Took " + (Date.now() - timeStart) + " ms"));
86
- const webServer = import_chalk.default.green(webFastify.listeningOrigin);
87
- const apiServer = import_chalk.default.magenta(
85
+ console.log(import_ansis.default.dim.italic("Took " + (Date.now() - timeStart) + " ms"));
86
+ const webServer = import_ansis.default.green(webFastify.listeningOrigin);
87
+ const apiServer = import_ansis.default.magenta(
88
88
  `${apiFastify.listeningOrigin}${options.apiRootPath}`
89
89
  );
90
- const graphqlEndpoint = import_chalk.default.magenta(`${apiServer}graphql`);
90
+ const graphqlEndpoint = import_ansis.default.magenta(`${apiServer}graphql`);
91
91
  console.log(`Web server listening at ${webServer}`);
92
92
  console.log(`API server listening at ${apiServer}`);
93
93
  console.log(`GraphQL endpoint at ${graphqlEndpoint}`);
@@ -33,7 +33,7 @@ __export(createServer_exports, {
33
33
  module.exports = __toCommonJS(createServer_exports);
34
34
  var import_fs = __toESM(require("fs"));
35
35
  var import_path = __toESM(require("path"));
36
- var import_chalk = __toESM(require("chalk"));
36
+ var import_ansis = __toESM(require("ansis"));
37
37
  var import_dotenv_defaults = require("dotenv-defaults");
38
38
  var import_fast_glob = __toESM(require("fast-glob"));
39
39
  var import_fastify = __toESM(require("fastify"));
@@ -64,7 +64,7 @@ async function createServer(options = {}) {
64
64
  );
65
65
  if (import_fs.default.existsSync(serverConfigPath)) {
66
66
  console.warn(
67
- import_chalk.default.yellow(
67
+ import_ansis.default.yellow(
68
68
  [
69
69
  "",
70
70
  `Ignoring \`config\` and \`configureServer\` in api/server.config.js.`,
@@ -123,7 +123,7 @@ async function createServer(options = {}) {
123
123
  });
124
124
  server.addHook("onListen", (done) => {
125
125
  console.log(
126
- `Server listening at ${import_chalk.default.magenta(
126
+ `Server listening at ${import_ansis.default.magenta(
127
127
  `${server.listeningOrigin}${apiRootPath}`
128
128
  )}`
129
129
  );
@@ -30,7 +30,7 @@ var import_split2 = __toESM(require("split2"));
30
30
  var import_fast_json_parse = __toESM(require("fast-json-parse"));
31
31
 
32
32
  // src/logFormatter/formatters.ts
33
- var import_chalk = __toESM(require("chalk"));
33
+ var import_ansis = __toESM(require("ansis"));
34
34
  var import_pretty_bytes = __toESM(require("pretty-bytes"));
35
35
  var import_pretty_ms = __toESM(require("pretty-ms"));
36
36
  var NEWLINE = "\n";
@@ -67,7 +67,7 @@ var isWideEmoji = (character) => {
67
67
  var formatBundleSize = (bundle) => {
68
68
  const bytes = parseInt(bundle, 10);
69
69
  const size = (0, import_pretty_bytes.default)(bytes).replace(/ /, "");
70
- return import_chalk.default.gray(size);
70
+ return import_ansis.default.gray(size);
71
71
  };
72
72
  var formatCustom = (query) => {
73
73
  if (!query) {
@@ -77,7 +77,7 @@ var formatCustom = (query) => {
77
77
  delete query[key];
78
78
  });
79
79
  if (!isEmptyObject(query)) {
80
- return import_chalk.default.white(
80
+ return import_ansis.default.white(
81
81
  NEWLINE + "\u{1F5D2} Custom" + NEWLINE + JSON.stringify(query, null, 2)
82
82
  );
83
83
  }
@@ -85,7 +85,7 @@ var formatCustom = (query) => {
85
85
  };
86
86
  var formatData = (data) => {
87
87
  if (!isEmptyObject(data)) {
88
- return import_chalk.default.white(
88
+ return import_ansis.default.white(
89
89
  NEWLINE + "\u{1F4E6} Result Data" + NEWLINE + JSON.stringify(data, null, 2)
90
90
  );
91
91
  }
@@ -97,14 +97,14 @@ var formatDate = (instant) => {
97
97
  const minutes = date.getMinutes().toString().padStart(2, "0");
98
98
  const seconds = date.getSeconds().toString().padStart(2, "0");
99
99
  const prettyDate = hours + ":" + minutes + ":" + seconds;
100
- return import_chalk.default.gray(prettyDate);
100
+ return import_ansis.default.gray(prettyDate);
101
101
  };
102
102
  var formatErrorProp = (errorPropValue) => {
103
103
  const errorType = errorPropValue["type"] || "Error";
104
104
  delete errorPropValue["message"];
105
105
  delete errorPropValue["stack"];
106
106
  delete errorPropValue["type"];
107
- return import_chalk.default.redBright(
107
+ return import_ansis.default.redBright(
108
108
  NEWLINE + NEWLINE + `\u{1F6A8} ${errorType} Info` + NEWLINE + NEWLINE + JSON.stringify(errorPropValue, null, 2) + NEWLINE
109
109
  );
110
110
  };
@@ -116,44 +116,44 @@ var formatLevel = (level) => {
116
116
  var formatLoadTime = (elapsedTime) => {
117
117
  const elapsed = parseInt(elapsedTime, 10);
118
118
  const time = (0, import_pretty_ms.default)(elapsed);
119
- return import_chalk.default.gray(time);
119
+ return import_ansis.default.gray(time);
120
120
  };
121
121
  var formatMessage = (logData) => {
122
122
  const { level, message } = logData;
123
123
  const msg = formatMessageName(message);
124
124
  let pretty;
125
125
  if (level === "error") {
126
- pretty = import_chalk.default.red(msg);
126
+ pretty = import_ansis.default.red(msg);
127
127
  }
128
128
  if (level === "trace") {
129
- pretty = import_chalk.default.white(msg);
129
+ pretty = import_ansis.default.white(msg);
130
130
  }
131
131
  if (level === "warn") {
132
132
  const orange = "#ffa500";
133
- pretty = import_chalk.default.hex(orange)(msg);
133
+ pretty = import_ansis.default.hex(orange)(msg);
134
134
  }
135
135
  if (level === "debug") {
136
- pretty = import_chalk.default.yellow(msg);
136
+ pretty = import_ansis.default.yellow(msg);
137
137
  }
138
138
  if (level === "info" || level === "customlevel") {
139
- pretty = import_chalk.default.green(msg);
139
+ pretty = import_ansis.default.green(msg);
140
140
  }
141
141
  if (level === "fatal") {
142
- pretty = import_chalk.default.white.bgRed(msg);
142
+ pretty = import_ansis.default.white.bgRed(msg);
143
143
  }
144
144
  return pretty;
145
145
  };
146
146
  var formatMethod = (method) => {
147
- return method && import_chalk.default.white(method);
147
+ return method && import_ansis.default.white(method);
148
148
  };
149
149
  var formatRequestId = (requestId) => {
150
- return requestId && import_chalk.default.cyan(requestId);
150
+ return requestId && import_ansis.default.cyan(requestId);
151
151
  };
152
152
  var formatNs = (ns) => {
153
- return ns && import_chalk.default.cyan(ns);
153
+ return ns && import_ansis.default.cyan(ns);
154
154
  };
155
155
  var formatName = (name) => {
156
- return name && import_chalk.default.blue(name);
156
+ return name && import_ansis.default.blue(name);
157
157
  };
158
158
  var formatMessageName = (message) => {
159
159
  if (message === void 0) {
@@ -168,11 +168,11 @@ var formatMessageName = (message) => {
168
168
  return message;
169
169
  };
170
170
  var formatOperationName = (operationName) => {
171
- return import_chalk.default.white(NEWLINE + "\u{1F3F7} " + operationName);
171
+ return import_ansis.default.white(NEWLINE + "\u{1F3F7} " + operationName);
172
172
  };
173
173
  var formatQuery = (query) => {
174
174
  if (!isEmptyObject(query)) {
175
- return import_chalk.default.white(
175
+ return import_ansis.default.white(
176
176
  NEWLINE + "\u{1F52D} Query" + NEWLINE + JSON.stringify(query, null, 2)
177
177
  );
178
178
  }
@@ -180,7 +180,7 @@ var formatQuery = (query) => {
180
180
  };
181
181
  var formatResponseCache = (responseCache) => {
182
182
  if (!isEmptyObject(responseCache)) {
183
- return import_chalk.default.white(
183
+ return import_ansis.default.white(
184
184
  NEWLINE + "\u{1F4BE} Response Cache" + NEWLINE + JSON.stringify(responseCache, null, 2)
185
185
  );
186
186
  }
@@ -188,26 +188,26 @@ var formatResponseCache = (responseCache) => {
188
188
  };
189
189
  var formatStatusCode = (statusCode) => {
190
190
  statusCode = statusCode || "xxx";
191
- return import_chalk.default.white(statusCode);
191
+ return import_ansis.default.white(statusCode);
192
192
  };
193
193
  var formatStack = (stack) => {
194
- return import_chalk.default.redBright(
194
+ return import_ansis.default.redBright(
195
195
  stack ? NEWLINE + "\u{1F95E} Error Stack" + NEWLINE + NEWLINE + stack + NEWLINE : ""
196
196
  );
197
197
  };
198
198
  var formatTracing = (data) => {
199
199
  if (!isEmptyObject(data)) {
200
- return import_chalk.default.white(
200
+ return import_ansis.default.white(
201
201
  NEWLINE + "\u23F0 Timing" + NEWLINE + JSON.stringify(data, null, 2)
202
202
  );
203
203
  }
204
204
  return;
205
205
  };
206
206
  var formatUrl = (url) => {
207
- return import_chalk.default.white(url);
207
+ return import_ansis.default.white(url);
208
208
  };
209
209
  var formatUserAgent = (userAgent) => {
210
- return import_chalk.default.grey(NEWLINE + "\u{1F575}\uFE0F\u200D\u2640\uFE0F " + userAgent);
210
+ return import_ansis.default.gray(NEWLINE + "\u{1F575}\uFE0F\u200D\u2640\uFE0F " + userAgent);
211
211
  };
212
212
  var noEmpty = (value) => {
213
213
  return !!value;
@@ -59,7 +59,7 @@ __export(formatters_exports, {
59
59
  noEmpty: () => noEmpty
60
60
  });
61
61
  module.exports = __toCommonJS(formatters_exports);
62
- var import_chalk = __toESM(require("chalk"));
62
+ var import_ansis = __toESM(require("ansis"));
63
63
  var import_pretty_bytes = __toESM(require("pretty-bytes"));
64
64
  var import_pretty_ms = __toESM(require("pretty-ms"));
65
65
  const NEWLINE = "\n";
@@ -96,7 +96,7 @@ const isWideEmoji = (character) => {
96
96
  const formatBundleSize = (bundle) => {
97
97
  const bytes = parseInt(bundle, 10);
98
98
  const size = (0, import_pretty_bytes.default)(bytes).replace(/ /, "");
99
- return import_chalk.default.gray(size);
99
+ return import_ansis.default.gray(size);
100
100
  };
101
101
  const formatCustom = (query) => {
102
102
  if (!query) {
@@ -106,7 +106,7 @@ const formatCustom = (query) => {
106
106
  delete query[key];
107
107
  });
108
108
  if (!isEmptyObject(query)) {
109
- return import_chalk.default.white(
109
+ return import_ansis.default.white(
110
110
  NEWLINE + "\u{1F5D2} Custom" + NEWLINE + JSON.stringify(query, null, 2)
111
111
  );
112
112
  }
@@ -114,7 +114,7 @@ const formatCustom = (query) => {
114
114
  };
115
115
  const formatData = (data) => {
116
116
  if (!isEmptyObject(data)) {
117
- return import_chalk.default.white(
117
+ return import_ansis.default.white(
118
118
  NEWLINE + "\u{1F4E6} Result Data" + NEWLINE + JSON.stringify(data, null, 2)
119
119
  );
120
120
  }
@@ -126,14 +126,14 @@ const formatDate = (instant) => {
126
126
  const minutes = date.getMinutes().toString().padStart(2, "0");
127
127
  const seconds = date.getSeconds().toString().padStart(2, "0");
128
128
  const prettyDate = hours + ":" + minutes + ":" + seconds;
129
- return import_chalk.default.gray(prettyDate);
129
+ return import_ansis.default.gray(prettyDate);
130
130
  };
131
131
  const formatErrorProp = (errorPropValue) => {
132
132
  const errorType = errorPropValue["type"] || "Error";
133
133
  delete errorPropValue["message"];
134
134
  delete errorPropValue["stack"];
135
135
  delete errorPropValue["type"];
136
- return import_chalk.default.redBright(
136
+ return import_ansis.default.redBright(
137
137
  NEWLINE + NEWLINE + `\u{1F6A8} ${errorType} Info` + NEWLINE + NEWLINE + JSON.stringify(errorPropValue, null, 2) + NEWLINE
138
138
  );
139
139
  };
@@ -145,44 +145,44 @@ const formatLevel = (level) => {
145
145
  const formatLoadTime = (elapsedTime) => {
146
146
  const elapsed = parseInt(elapsedTime, 10);
147
147
  const time = (0, import_pretty_ms.default)(elapsed);
148
- return import_chalk.default.gray(time);
148
+ return import_ansis.default.gray(time);
149
149
  };
150
150
  const formatMessage = (logData) => {
151
151
  const { level, message } = logData;
152
152
  const msg = formatMessageName(message);
153
153
  let pretty;
154
154
  if (level === "error") {
155
- pretty = import_chalk.default.red(msg);
155
+ pretty = import_ansis.default.red(msg);
156
156
  }
157
157
  if (level === "trace") {
158
- pretty = import_chalk.default.white(msg);
158
+ pretty = import_ansis.default.white(msg);
159
159
  }
160
160
  if (level === "warn") {
161
161
  const orange = "#ffa500";
162
- pretty = import_chalk.default.hex(orange)(msg);
162
+ pretty = import_ansis.default.hex(orange)(msg);
163
163
  }
164
164
  if (level === "debug") {
165
- pretty = import_chalk.default.yellow(msg);
165
+ pretty = import_ansis.default.yellow(msg);
166
166
  }
167
167
  if (level === "info" || level === "customlevel") {
168
- pretty = import_chalk.default.green(msg);
168
+ pretty = import_ansis.default.green(msg);
169
169
  }
170
170
  if (level === "fatal") {
171
- pretty = import_chalk.default.white.bgRed(msg);
171
+ pretty = import_ansis.default.white.bgRed(msg);
172
172
  }
173
173
  return pretty;
174
174
  };
175
175
  const formatMethod = (method) => {
176
- return method && import_chalk.default.white(method);
176
+ return method && import_ansis.default.white(method);
177
177
  };
178
178
  const formatRequestId = (requestId) => {
179
- return requestId && import_chalk.default.cyan(requestId);
179
+ return requestId && import_ansis.default.cyan(requestId);
180
180
  };
181
181
  const formatNs = (ns) => {
182
- return ns && import_chalk.default.cyan(ns);
182
+ return ns && import_ansis.default.cyan(ns);
183
183
  };
184
184
  const formatName = (name) => {
185
- return name && import_chalk.default.blue(name);
185
+ return name && import_ansis.default.blue(name);
186
186
  };
187
187
  const formatMessageName = (message) => {
188
188
  if (message === void 0) {
@@ -197,11 +197,11 @@ const formatMessageName = (message) => {
197
197
  return message;
198
198
  };
199
199
  const formatOperationName = (operationName) => {
200
- return import_chalk.default.white(NEWLINE + "\u{1F3F7} " + operationName);
200
+ return import_ansis.default.white(NEWLINE + "\u{1F3F7} " + operationName);
201
201
  };
202
202
  const formatQuery = (query) => {
203
203
  if (!isEmptyObject(query)) {
204
- return import_chalk.default.white(
204
+ return import_ansis.default.white(
205
205
  NEWLINE + "\u{1F52D} Query" + NEWLINE + JSON.stringify(query, null, 2)
206
206
  );
207
207
  }
@@ -209,7 +209,7 @@ const formatQuery = (query) => {
209
209
  };
210
210
  const formatResponseCache = (responseCache) => {
211
211
  if (!isEmptyObject(responseCache)) {
212
- return import_chalk.default.white(
212
+ return import_ansis.default.white(
213
213
  NEWLINE + "\u{1F4BE} Response Cache" + NEWLINE + JSON.stringify(responseCache, null, 2)
214
214
  );
215
215
  }
@@ -217,26 +217,26 @@ const formatResponseCache = (responseCache) => {
217
217
  };
218
218
  const formatStatusCode = (statusCode) => {
219
219
  statusCode = statusCode || "xxx";
220
- return import_chalk.default.white(statusCode);
220
+ return import_ansis.default.white(statusCode);
221
221
  };
222
222
  const formatStack = (stack) => {
223
- return import_chalk.default.redBright(
223
+ return import_ansis.default.redBright(
224
224
  stack ? NEWLINE + "\u{1F95E} Error Stack" + NEWLINE + NEWLINE + stack + NEWLINE : ""
225
225
  );
226
226
  };
227
227
  const formatTracing = (data) => {
228
228
  if (!isEmptyObject(data)) {
229
- return import_chalk.default.white(
229
+ return import_ansis.default.white(
230
230
  NEWLINE + "\u23F0 Timing" + NEWLINE + JSON.stringify(data, null, 2)
231
231
  );
232
232
  }
233
233
  return;
234
234
  };
235
235
  const formatUrl = (url) => {
236
- return import_chalk.default.white(url);
236
+ return import_ansis.default.white(url);
237
237
  };
238
238
  const formatUserAgent = (userAgent) => {
239
- return import_chalk.default.grey(NEWLINE + "\u{1F575}\uFE0F\u200D\u2640\uFE0F " + userAgent);
239
+ return import_ansis.default.gray(NEWLINE + "\u{1F575}\uFE0F\u200D\u2640\uFE0F " + userAgent);
240
240
  };
241
241
  const noEmpty = (value) => {
242
242
  return !!value;
@@ -1 +1 @@
1
- {"version":3,"file":"lambdaLoader.d.ts","sourceRoot":"","sources":["../../src/plugins/lambdaLoader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAGzC,OAAO,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3D,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,uBAAuB,EACxB,MAAM,SAAS,CAAA;AAOhB,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAC7C,eAAO,MAAM,gBAAgB,EAAE,OAAY,CAAA;AAI3C,eAAO,MAAM,kBAAkB,mBAA0B,MAAM,EAAE,kBAsDhE,CAAA;AAED,KAAK,4BAA4B,GAAG;IAClC,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,qBAAqB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC1C,CAAA;AAGD,eAAO,MAAM,qBAAqB,aACvB,4BAA4B,kBAetC,CAAA;AA0BD,UAAU,oBAAqB,SAAQ,uBAAuB;IAC5D,MAAM,EAAE;QACN,SAAS,EAAE,MAAM,CAAA;KAClB,CAAA;CACF;AAED;;;;IAII;AACJ,eAAO,MAAM,oBAAoB,QAC1B,cAAc,CAAC,oBAAoB,CAAC,SAClC,YAAY,kBAsBpB,CAAA"}
1
+ {"version":3,"file":"lambdaLoader.d.ts","sourceRoot":"","sources":["../../src/plugins/lambdaLoader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEzC,OAAO,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3D,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,uBAAuB,EACxB,MAAM,SAAS,CAAA;AAOhB,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAC7C,eAAO,MAAM,gBAAgB,EAAE,OAAY,CAAA;AAI3C,eAAO,MAAM,kBAAkB,mBAA0B,MAAM,EAAE,kBAsDhE,CAAA;AAED,KAAK,4BAA4B,GAAG;IAClC,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,qBAAqB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC1C,CAAA;AAGD,eAAO,MAAM,qBAAqB,aACvB,4BAA4B,kBAetC,CAAA;AA0BD,UAAU,oBAAqB,SAAQ,uBAAuB;IAC5D,MAAM,EAAE;QACN,SAAS,EAAE,MAAM,CAAA;KAClB,CAAA;CACF;AAED;;;;IAII;AACJ,eAAO,MAAM,oBAAoB,QAC1B,cAAc,CAAC,oBAAoB,CAAC,SAClC,YAAY,kBAsBpB,CAAA"}
@@ -35,7 +35,7 @@ __export(lambdaLoader_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(lambdaLoader_exports);
37
37
  var import_path = __toESM(require("path"));
38
- var import_chalk = __toESM(require("chalk"));
38
+ var import_ansis = __toESM(require("ansis"));
39
39
  var import_fast_glob = __toESM(require("fast-glob"));
40
40
  var import_lodash = require("lodash");
41
41
  var import_project_config = require("@cedarjs/project-config");
@@ -43,7 +43,7 @@ var import_awsLambdaFastify = require("../requestHandlers/awsLambdaFastify");
43
43
  const LAMBDA_FUNCTIONS = {};
44
44
  const setLambdaFunctions = async (foundFunctions) => {
45
45
  const tsImport = Date.now();
46
- console.log(import_chalk.default.dim.italic("Importing Server Functions... "));
46
+ console.log(import_ansis.default.dim.italic("Importing Server Functions... "));
47
47
  const imports = foundFunctions.map(async (fnPath) => {
48
48
  const ts = Date.now();
49
49
  const routeName = import_path.default.basename(fnPath).replace(".js", "");
@@ -69,13 +69,13 @@ const setLambdaFunctions = async (foundFunctions) => {
69
69
  );
70
70
  }
71
71
  console.log(
72
- import_chalk.default.magenta("/" + routeName),
73
- import_chalk.default.dim.italic(Date.now() - ts + " ms")
72
+ import_ansis.default.magenta("/" + routeName),
73
+ import_ansis.default.dim.italic(Date.now() - ts + " ms")
74
74
  );
75
75
  });
76
76
  await Promise.all(imports);
77
77
  console.log(
78
- import_chalk.default.dim.italic("...Done importing in " + (Date.now() - tsImport) + " ms")
78
+ import_ansis.default.dim.italic("...Done importing in " + (Date.now() - tsImport) + " ms")
79
79
  );
80
80
  };
81
81
  const loadFunctionsFromDist = async (options = {}) => {
@@ -35,7 +35,7 @@ module.exports = __toCommonJS(serverManager_exports);
35
35
  var import_child_process = require("child_process");
36
36
  var import_fs = __toESM(require("fs"));
37
37
  var import_path = __toESM(require("path"));
38
- var import_chalk = __toESM(require("chalk"));
38
+ var import_ansis = __toESM(require("ansis"));
39
39
  var import_yargs = __toESM(require("yargs"));
40
40
  var import_helpers = require("yargs/helpers");
41
41
  var import_project_config = require("@cedarjs/project-config");
@@ -106,19 +106,19 @@ class ServerManager {
106
106
  return;
107
107
  }
108
108
  await new Promise((resolve) => {
109
- console.log(import_chalk.default.yellow("Shutting down API server."));
109
+ console.log(import_ansis.default.yellow("Shutting down API server."));
110
110
  const cleanup = () => {
111
111
  this.httpServerProcess?.removeAllListeners("exit");
112
112
  clearTimeout(forceKillTimeout);
113
113
  };
114
114
  this.httpServerProcess?.on("exit", () => {
115
- console.log(import_chalk.default.yellow("API server exited."));
115
+ console.log(import_ansis.default.yellow("API server exited."));
116
116
  cleanup();
117
117
  resolve();
118
118
  });
119
119
  const forceKillTimeout = setTimeout(() => {
120
120
  console.log(
121
- import_chalk.default.yellow(
121
+ import_ansis.default.yellow(
122
122
  "API server did not exit within 2 seconds, forcefully closing it."
123
123
  )
124
124
  );
package/dist/watch.js CHANGED
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
 
26
26
  // src/watch.ts
27
27
  var import_path2 = __toESM(require("path"));
28
- var import_chalk2 = __toESM(require("chalk"));
28
+ var import_ansis2 = __toESM(require("ansis"));
29
29
  var import_chokidar = __toESM(require("chokidar"));
30
30
  var import_dotenv = __toESM(require("dotenv"));
31
31
  var import_api = require("@cedarjs/internal/dist/build/api");
@@ -85,7 +85,7 @@ var BuildManager = class {
85
85
  var import_child_process = require("child_process");
86
86
  var import_fs = __toESM(require("fs"));
87
87
  var import_path = __toESM(require("path"));
88
- var import_chalk = __toESM(require("chalk"));
88
+ var import_ansis = __toESM(require("ansis"));
89
89
  var import_yargs = __toESM(require("yargs"));
90
90
  var import_helpers = require("yargs/helpers");
91
91
  var import_project_config = require("@cedarjs/project-config");
@@ -156,19 +156,19 @@ var ServerManager = class {
156
156
  return;
157
157
  }
158
158
  await new Promise((resolve) => {
159
- console.log(import_chalk.default.yellow("Shutting down API server."));
159
+ console.log(import_ansis.default.yellow("Shutting down API server."));
160
160
  const cleanup = () => {
161
161
  this.httpServerProcess?.removeAllListeners("exit");
162
162
  clearTimeout(forceKillTimeout);
163
163
  };
164
164
  this.httpServerProcess?.on("exit", () => {
165
- console.log(import_chalk.default.yellow("API server exited."));
165
+ console.log(import_ansis.default.yellow("API server exited."));
166
166
  cleanup();
167
167
  resolve();
168
168
  });
169
169
  const forceKillTimeout = setTimeout(() => {
170
170
  console.log(
171
- import_chalk.default.yellow(
171
+ import_ansis.default.yellow(
172
172
  "API server did not exit within 2 seconds, forcefully closing it."
173
173
  )
174
174
  );
@@ -195,7 +195,7 @@ if (!process.env.REDWOOD_ENV_FILES_LOADED) {
195
195
  }
196
196
  async function buildAndServe(options) {
197
197
  const buildTs = Date.now();
198
- console.log(import_chalk2.default.dim.italic("Building..."));
198
+ console.log(import_ansis2.default.dim.italic("Building..."));
199
199
  if (options.clean) {
200
200
  await (0, import_api.cleanApiBuild)();
201
201
  }
@@ -205,7 +205,7 @@ async function buildAndServe(options) {
205
205
  await (0, import_api.buildApi)();
206
206
  }
207
207
  await serverManager.restartApiServer();
208
- console.log(import_chalk2.default.dim.italic("Took " + (Date.now() - buildTs) + " ms"));
208
+ console.log(import_ansis2.default.dim.italic("Took " + (Date.now() - buildTs) + " ms"));
209
209
  }
210
210
  var buildManager = new BuildManager(buildAndServe);
211
211
  async function validateSdls() {
@@ -215,10 +215,10 @@ async function validateSdls() {
215
215
  } catch (e) {
216
216
  serverManager.killApiServer();
217
217
  console.error(
218
- import_chalk2.default.redBright(`[GQL Server Error] - Schema validation failed`)
218
+ import_ansis2.default.redBright(`[GQL Server Error] - Schema validation failed`)
219
219
  );
220
- console.error(import_chalk2.default.red(e?.message));
221
- console.error(import_chalk2.default.redBright("-".repeat(40)));
220
+ console.error(import_ansis2.default.red(e?.message));
221
+ console.error(import_ansis2.default.redBright("-".repeat(40)));
222
222
  buildManager.cancelScheduledBuild();
223
223
  return false;
224
224
  }
@@ -263,7 +263,7 @@ import_chokidar.default.watch([rwjsPaths2.api.src], {
263
263
  }
264
264
  }
265
265
  console.log(
266
- import_chalk2.default.dim(`[${eventName}] ${filePath.replace(rwjsPaths2.api.base, "")}`)
266
+ import_ansis2.default.dim(`[${eventName}] ${filePath.replace(rwjsPaths2.api.base, "")}`)
267
267
  );
268
268
  buildManager.cancelScheduledBuild();
269
269
  if (eventName === "add" || eventName === "unlink") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/api-server",
3
- "version": "1.0.0-canary.12464+73fbee82a",
3
+ "version": "1.0.0-canary.12466+9fe1f2da5",
4
4
  "description": "CedarJS's HTTP server for Serverless Functions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,14 +29,14 @@
29
29
  "test:watch": "vitest watch"
30
30
  },
31
31
  "dependencies": {
32
- "@cedarjs/context": "1.0.0-canary.12464",
33
- "@cedarjs/fastify-web": "1.0.0-canary.12464",
34
- "@cedarjs/internal": "1.0.0-canary.12464",
35
- "@cedarjs/project-config": "1.0.0-canary.12464",
36
- "@cedarjs/web-server": "1.0.0-canary.12464",
32
+ "@cedarjs/context": "1.0.0-canary.12466",
33
+ "@cedarjs/fastify-web": "1.0.0-canary.12466",
34
+ "@cedarjs/internal": "1.0.0-canary.12466",
35
+ "@cedarjs/project-config": "1.0.0-canary.12466",
36
+ "@cedarjs/web-server": "1.0.0-canary.12466",
37
37
  "@fastify/multipart": "9.0.3",
38
38
  "@fastify/url-data": "6.0.3",
39
- "chalk": "4.1.2",
39
+ "ansis": "4.1.0",
40
40
  "chokidar": "3.6.0",
41
41
  "dotenv-defaults": "5.0.2",
42
42
  "fast-glob": "3.3.3",
@@ -51,7 +51,7 @@
51
51
  "yargs": "17.7.2"
52
52
  },
53
53
  "devDependencies": {
54
- "@cedarjs/framework-tools": "1.0.0-canary.12464",
54
+ "@cedarjs/framework-tools": "1.0.0-canary.12466",
55
55
  "@types/aws-lambda": "8.10.152",
56
56
  "@types/lodash": "4.17.20",
57
57
  "@types/qs": "6.9.16",
@@ -64,12 +64,12 @@
64
64
  "vitest": "3.2.4"
65
65
  },
66
66
  "peerDependencies": {
67
- "@cedarjs/graphql-server": "1.0.0-canary.12464"
67
+ "@cedarjs/graphql-server": "1.0.0-canary.12466"
68
68
  },
69
69
  "peerDependenciesMeta": {
70
70
  "@cedarjs/graphql-server": {
71
71
  "optional": true
72
72
  }
73
73
  },
74
- "gitHead": "73fbee82a97ab2c1e85d12cffff5b9ba57142618"
74
+ "gitHead": "9fe1f2da58b9f66ee7e71cbd1f43ab2fa567ab09"
75
75
  }