@mikro-orm/reflection 7.0.0-dev.106 → 7.0.0-dev.108

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.
@@ -1,6 +1,7 @@
1
1
  import { extname } from 'node:path';
2
2
  import { ComputedPropertyName, ModuleKind, NoSubstitutionTemplateLiteral, Project, StringLiteral } from 'ts-morph';
3
3
  import { MetadataError, MetadataProvider, MetadataStorage, RawQueryFragment, ReferenceKind, Type, Utils, } from '@mikro-orm/core';
4
+ import { fs } from '@mikro-orm/core/fs-utils';
4
5
  export class TsMorphMetadataProvider extends MetadataProvider {
5
6
  project;
6
7
  sources;
@@ -139,13 +140,13 @@ export class TsMorphMetadataProvider extends MetadataProvider {
139
140
  let path = tsPath;
140
141
  /* v8 ignore next */
141
142
  if (outDir != null) {
142
- const outDirRelative = Utils.relativePath(outDir, baseDir);
143
+ const outDirRelative = fs.relativePath(outDir, baseDir);
143
144
  path = path.replace(new RegExp(`^${outDirRelative}`), '');
144
145
  }
145
146
  path = this.stripRelativePath(path);
146
147
  const source = this.sources.find(s => s.getFilePath().endsWith(path));
147
148
  if (!source && validate) {
148
- throw new MetadataError(`Source file '${tsPath}' not found. Check your 'entitiesTs' option and verify you have 'compilerOptions.declaration' enabled in your 'tsconfig.json'. If you are using webpack, see https://bit.ly/35pPDNn`);
149
+ throw new MetadataError(`Source file '${fs.relativePath(tsPath, baseDir)}' not found. Check your 'entitiesTs' option and verify you have 'compilerOptions.declaration' enabled in your 'tsconfig.json'. If you are using webpack, see https://bit.ly/35pPDNn`);
149
150
  }
150
151
  return source;
151
152
  }
@@ -175,7 +176,7 @@ export class TsMorphMetadataProvider extends MetadataProvider {
175
176
  const tsConfigFilePath = this.config.get('discovery').tsConfigPath ?? './tsconfig.json';
176
177
  try {
177
178
  this.project = new Project({
178
- tsConfigFilePath: Utils.normalizePath(process.cwd(), tsConfigFilePath),
179
+ tsConfigFilePath: fs.normalizePath(process.cwd(), tsConfigFilePath),
179
180
  skipAddingFilesFromTsConfig: true,
180
181
  compilerOptions: {
181
182
  strictNullChecks: true,
@@ -247,6 +248,7 @@ export class TsMorphMetadataProvider extends MetadataProvider {
247
248
  ].forEach(key => delete copy[key]);
248
249
  // base entity without properties might not have path, but nothing to cache there
249
250
  if (meta.path) {
251
+ meta.path = fs.relativePath(meta.path, this.config.get('baseDir'));
250
252
  this.config.getMetadataCacheAdapter().set(this.getCacheKey(meta), copy, meta.path);
251
253
  }
252
254
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mikro-orm/reflection",
3
3
  "type": "module",
4
- "version": "7.0.0-dev.106",
4
+ "version": "7.0.0-dev.108",
5
5
  "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.",
6
6
  "exports": {
7
7
  "./package.json": "./package.json",
@@ -56,6 +56,6 @@
56
56
  "@mikro-orm/core": "^6.6.2"
57
57
  },
58
58
  "peerDependencies": {
59
- "@mikro-orm/core": "7.0.0-dev.106"
59
+ "@mikro-orm/core": "7.0.0-dev.108"
60
60
  }
61
61
  }