@dudousxd/nestjs-codegen 0.7.0 → 0.7.1

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/cli/main.js CHANGED
@@ -44,18 +44,23 @@ async function fileExists(filePath) {
44
44
  }
45
45
  }
46
46
  async function importTs(filePath) {
47
- let tsImport;
47
+ const fileUrl = pathToFileURL(filePath).href;
48
48
  try {
49
- const tsxEsm = await import("tsx/esm/api");
50
- tsImport = tsxEsm.tsImport;
51
- } catch {
52
- throw new ConfigError(
53
- "Failed to load config: `tsx` is required for loading TypeScript config files. Install it as a dev dependency: pnpm add -D tsx"
54
- );
49
+ return await import(fileUrl);
50
+ } catch (nativeError) {
51
+ let tsImport;
52
+ try {
53
+ const tsxEsm = await import("tsx/esm/api");
54
+ tsImport = tsxEsm.tsImport;
55
+ } catch {
56
+ throw new ConfigError(
57
+ "Failed to load config: `tsx` is required for loading TypeScript config files. Install it as a dev dependency: pnpm add -D tsx",
58
+ { cause: nativeError }
59
+ );
60
+ }
61
+ const parentURL = pathToFileURL(`${filePath}__parent__`).href;
62
+ return tsImport(fileUrl, { parentURL });
55
63
  }
56
- const parentURL = pathToFileURL(`${filePath}__parent__`).href;
57
- const fileUrl = pathToFileURL(filePath).href;
58
- return tsImport(fileUrl, { parentURL });
59
64
  }
60
65
  function resolveAbsolute(cwd, p) {
61
66
  if (isAbsolute(p)) return p;
@@ -4457,7 +4462,7 @@ async function watch(config, onChange) {
4457
4462
  }
4458
4463
 
4459
4464
  // src/index.ts
4460
- var VERSION = "0.7.0";
4465
+ var VERSION = "0.7.1";
4461
4466
 
4462
4467
  // src/cli/codegen.ts
4463
4468
  async function runCodegen(opts = {}) {