@mikro-orm/reflection 6.4.2-dev.0 → 6.4.2-dev.10

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.
@@ -180,15 +180,21 @@ class TsMorphMetadataProvider extends core_1.MetadataProvider {
180
180
  if (!this.project) {
181
181
  this.initProject();
182
182
  }
183
+ this.sources = [];
183
184
  // All entity files are first required during the discovery, before we reach here, so it is safe to get the parts from the global
184
- // metadata storage. We know the path thanks the decorators being executed. In case we are running via ts-node, the extension
185
- // will be already `.ts`, so no change needed. `.js` files will get renamed to `.d.ts` files as they will be used as a source for
185
+ // metadata storage. We know the path thanks to the decorators being executed. In case we are running via ts-node, the extension
186
+ // will be already `.ts`, so no change is needed. `.js` files will get renamed to `.d.ts` files as they will be used as a source for
186
187
  // the ts-morph reflection.
187
- /* istanbul ignore next */
188
- const paths = Object.values(core_1.MetadataStorage.getMetadata()).map(m => m.path.match(/\.[jt]s$/)
189
- ? m.path.replace(/\.js$/, '.d.ts')
190
- : `${m.path}.d.ts`); // when entities are bundled, their paths are just their names
191
- this.sources = this.project.addSourceFilesAtPaths(paths);
188
+ for (const meta of core_1.Utils.values(core_1.MetadataStorage.getMetadata())) {
189
+ /* istanbul ignore next */
190
+ const path = meta.path.match(/\.[jt]s$/)
191
+ ? meta.path.replace(/\.js$/, '.d.ts')
192
+ : `${meta.path}.d.ts`; // when entities are bundled, their paths are just their names
193
+ const sourceFile = this.project.addSourceFileAtPathIfExists(path);
194
+ if (sourceFile) {
195
+ this.sources.push(sourceFile);
196
+ }
197
+ }
192
198
  }
193
199
  }
194
200
  exports.TsMorphMetadataProvider = TsMorphMetadataProvider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/reflection",
3
- "version": "6.4.2-dev.0",
3
+ "version": "6.4.2-dev.10",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -65,6 +65,6 @@
65
65
  "@mikro-orm/core": "^6.4.1"
66
66
  },
67
67
  "peerDependencies": {
68
- "@mikro-orm/core": "6.4.2-dev.0"
68
+ "@mikro-orm/core": "6.4.2-dev.10"
69
69
  }
70
70
  }