@igniter-js/cli 0.4.2 → 0.4.4

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/dist/index.mjs CHANGED
@@ -3143,7 +3143,7 @@ import * as path18 from "path";
3143
3143
  import { build } from "esbuild";
3144
3144
  import zodToJsonSchema from "zod-to-json-schema";
3145
3145
  import { createRequire } from "module";
3146
- import nodeExternals from "esbuild-node-externals";
3146
+ import { nodeExternalsPlugin } from "esbuild-node-externals";
3147
3147
  import * as p8 from "@clack/prompts";
3148
3148
  var RouterLoadError = class extends Error {
3149
3149
  constructor(message, originalError) {
@@ -3176,7 +3176,7 @@ var RouterInstrospector = class _RouterInstrospector {
3176
3176
  // Keep the result in memory
3177
3177
  logLevel: "silent",
3178
3178
  // We will handle our own logging
3179
- plugins: [nodeExternals()],
3179
+ plugins: [nodeExternalsPlugin()],
3180
3180
  external: [
3181
3181
  "@igniter-js/*",
3182
3182
  "@prisma/*",
@@ -3191,7 +3191,7 @@ var RouterInstrospector = class _RouterInstrospector {
3191
3191
  });
3192
3192
  const [outputFile] = result.outputFiles;
3193
3193
  if (!outputFile) {
3194
- throw new Error("esbuild did not produce any output.");
3194
+ throw new RouterLoadError("esbuild did not produce any output.");
3195
3195
  }
3196
3196
  const compiledCode = outputFile.text;
3197
3197
  const routerModule = { exports: {} };
@@ -3210,7 +3210,7 @@ var RouterInstrospector = class _RouterInstrospector {
3210
3210
  if (router && typeof router.controllers === "object") {
3211
3211
  return router;
3212
3212
  }
3213
- throw new Error("Module was compiled and loaded, but no valid Igniter router export was found.");
3213
+ throw new RouterLoadError("Module was compiled and loaded, but no valid Igniter router export was found.");
3214
3214
  } catch (error) {
3215
3215
  if (error && Array.isArray(error.errors)) {
3216
3216
  const buildFailure = error;
@@ -3219,7 +3219,7 @@ var RouterInstrospector = class _RouterInstrospector {
3219
3219
  ${errorMessages}`;
3220
3220
  throw new RouterLoadError(detailedMessage, error);
3221
3221
  }
3222
- p8.log.error(error);
3222
+ p8.log.error(`Error loading router: ${error instanceof Error ? error.message : String(error)}`);
3223
3223
  throw new RouterLoadError(`Failed to load router from ${routerPath}`, error);
3224
3224
  }
3225
3225
  }
@@ -3237,16 +3237,20 @@ ${errorMessages}`;
3237
3237
  const typedController = controller;
3238
3238
  if (typedController && typedController.actions) {
3239
3239
  for (const [actionName, action] of Object.entries(typedController.actions)) {
3240
- const typedAction = action;
3241
- introspectedActions[actionName] = {
3242
- name: actionName,
3243
- path: typedAction.path,
3244
- method: typedAction.method,
3245
- description: typedAction.description,
3246
- bodySchema: typedAction.body ? zodToJsonSchema(typedAction.body, { target: "openApi3" }) : void 0,
3247
- querySchema: typedAction.query ? zodToJsonSchema(typedAction.query, { target: "openApi3" }) : void 0
3248
- };
3249
- totalActions++;
3240
+ try {
3241
+ const typedAction = action;
3242
+ introspectedActions[actionName] = {
3243
+ name: actionName,
3244
+ path: typedAction.path,
3245
+ method: typedAction.method,
3246
+ description: typedAction.description,
3247
+ bodySchema: typedAction.body ? zodToJsonSchema(typedAction.body, { target: "openApi3" }) : void 0,
3248
+ querySchema: typedAction.query ? zodToJsonSchema(typedAction.query, { target: "openApi3" }) : void 0
3249
+ };
3250
+ totalActions++;
3251
+ } catch (err) {
3252
+ throw err;
3253
+ }
3250
3254
  }
3251
3255
  }
3252
3256
  introspectedControllers[controllerName] = {