@dudousxd/nestjs-codegen 0.27.1 → 0.27.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @dudousxd/nestjs-codegen
2
2
 
3
+ ## 0.27.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#105](https://github.com/DavideCarvalho/nestjs-codegen/pull/105) [`12be710`](https://github.com/DavideCarvalho/nestjs-codegen/commit/12be710f3c21ccc2e058d901a9921a72587ad939) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Follow relative imports inside declaration files to their declarations: `./chunk.cjs` resolves to `chunk.d.cts` (and `.cts`), `./chunk.mjs` to `chunk.d.mts`, `./chunk.js` to `chunk.d.ts` — after the source candidates, as before. A package's bundled `index.d.cts` imports its chunks by runtime name, and those types came out `unknown`.
8
+
3
9
  ## 0.27.1
4
10
 
5
11
  ### Patch Changes
package/dist/cli/main.cjs CHANGED
@@ -708,12 +708,18 @@ function findTypeInFile(name, file) {
708
708
  function resolveModuleSpecifier(moduleSpecifier, sourceFile, project) {
709
709
  if (moduleSpecifier.startsWith(".")) {
710
710
  const dir = (0, import_node_path4.dirname)(sourceFile.getFilePath());
711
- const noExt = moduleSpecifier.replace(/\.(js|ts)$/, "");
712
- return [
713
- (0, import_node_path4.resolve)(dir, `${noExt}.ts`),
711
+ const ext = /\.(c|m)?(j|t)sx?$/.exec(moduleSpecifier)?.[0];
712
+ const base = ext ? moduleSpecifier.slice(0, -ext.length) : moduleSpecifier;
713
+ const flavour = ext?.startsWith(".c") ? "c" : ext?.startsWith(".m") ? "m" : "";
714
+ const candidates = [
715
+ (0, import_node_path4.resolve)(dir, `${base}.${flavour}ts`),
716
+ ...flavour === "" ? [(0, import_node_path4.resolve)(dir, `${base}.tsx`)] : [],
714
717
  (0, import_node_path4.resolve)(dir, `${moduleSpecifier}.ts`),
715
- (0, import_node_path4.resolve)(dir, moduleSpecifier, "index.ts")
718
+ (0, import_node_path4.resolve)(dir, moduleSpecifier, "index.ts"),
719
+ (0, import_node_path4.resolve)(dir, `${base}.d.${flavour}ts`),
720
+ ...ext === void 0 ? [(0, import_node_path4.resolve)(dir, moduleSpecifier, "index.d.ts")] : []
716
721
  ];
722
+ return [...new Set(candidates)];
717
723
  }
718
724
  const ctx = _ctxFor(project);
719
725
  const baseUrl = ctx.pathsBase ?? ctx.projectRoot;
@@ -6021,7 +6027,7 @@ async function watch(config, onChange, options = {}) {
6021
6027
  }
6022
6028
 
6023
6029
  // src/index.ts
6024
- var VERSION = "0.27.1";
6030
+ var VERSION = "0.27.2";
6025
6031
 
6026
6032
  // src/cli/codegen.ts
6027
6033
  async function runCodegen(opts = {}) {