@mikro-orm/reflection 7.0.0-dev.65 → 7.0.0-dev.66

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.
@@ -12,6 +12,7 @@ export declare class TsMorphMetadataProvider extends MetadataProvider {
12
12
  private initPropertyType;
13
13
  private readTypeFromSource;
14
14
  private getSourceFile;
15
+ private stripRelativePath;
15
16
  private processWrapper;
16
17
  private initProject;
17
18
  private initSourceFiles;
@@ -28,7 +28,7 @@ export class TsMorphMetadataProvider extends MetadataProvider {
28
28
  }
29
29
  }
30
30
  extractType(prop) {
31
- if (Utils.isString(prop.entity)) {
31
+ if (typeof prop.entity === 'string') {
32
32
  return prop.entity;
33
33
  }
34
34
  if (prop.entity) {
@@ -137,13 +137,16 @@ export class TsMorphMetadataProvider extends MetadataProvider {
137
137
  const outDirRelative = Utils.relativePath(outDir, baseDir);
138
138
  path = path.replace(new RegExp(`^${outDirRelative}`), '');
139
139
  }
140
- path = Utils.stripRelativePath(path);
140
+ path = this.stripRelativePath(path);
141
141
  const source = this.sources.find(s => s.getFilePath().endsWith(path));
142
142
  if (!source && validate) {
143
143
  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`);
144
144
  }
145
145
  return source;
146
146
  }
147
+ stripRelativePath(str) {
148
+ return str.replace(/^(?:\.\.\/|\.\/)+/, '/');
149
+ }
147
150
  processWrapper(prop, wrapper) {
148
151
  // type can be sometimes in form of:
149
152
  // `'({ object?: Entity | undefined; } & import("...").Reference<Entity>)'`
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.65",
4
+ "version": "7.0.0-dev.66",
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.1"
57
57
  },
58
58
  "peerDependencies": {
59
- "@mikro-orm/core": "7.0.0-dev.65"
59
+ "@mikro-orm/core": "7.0.0-dev.66"
60
60
  }
61
61
  }