@mikro-orm/core 6.3.14-dev.70 → 6.3.14-dev.71

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/MikroORM.js CHANGED
@@ -174,11 +174,11 @@ class MikroORM {
174
174
  return this.metadata;
175
175
  }
176
176
  async discoverEntities() {
177
- this.metadata = await this.discovery.discover(this.config.get('tsNode'));
177
+ this.metadata = await this.discovery.discover(this.config.get('preferTs'));
178
178
  this.createEntityManager();
179
179
  }
180
180
  discoverEntitiesSync() {
181
- this.metadata = this.discovery.discoverSync(this.config.get('tsNode'));
181
+ this.metadata = this.discovery.discoverSync(this.config.get('preferTs'));
182
182
  this.createEntityManager();
183
183
  }
184
184
  createEntityManager() {
@@ -127,10 +127,10 @@ class MetadataDiscovery {
127
127
  return meta;
128
128
  });
129
129
  }
130
- findEntities(preferTsNode, sync = false) {
130
+ findEntities(preferTs, sync = false) {
131
131
  this.discovered.length = 0;
132
132
  const options = this.config.get('discovery');
133
- const key = (preferTsNode && this.config.get('tsNode', Utils_1.Utils.detectTsNode()) && this.config.get('entitiesTs').length > 0) ? 'entitiesTs' : 'entities';
133
+ const key = (preferTs && this.config.get('preferTs', Utils_1.Utils.detectTsNode()) && this.config.get('entitiesTs').length > 0) ? 'entitiesTs' : 'entities';
134
134
  const paths = this.config.get(key).filter(item => Utils_1.Utils.isString(item));
135
135
  const refs = this.config.get(key).filter(item => !Utils_1.Utils.isString(item));
136
136
  if (paths.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.3.14-dev.70",
3
+ "version": "6.3.14-dev.71",
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",
@@ -64,7 +64,7 @@
64
64
  "esprima": "4.0.1",
65
65
  "fs-extra": "11.2.0",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.3.14-dev.70",
67
+ "mikro-orm": "6.3.14-dev.71",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }
@@ -370,6 +370,13 @@ export interface MikroORMOptions<D extends IDatabaseDriver = IDatabaseDriver, EM
370
370
  debug: boolean | LoggerNamespace[];
371
371
  ignoreDeprecations: boolean | string[];
372
372
  highlighter: Highlighter;
373
+ /**
374
+ * Using this option, you can force the ORM to use the TS options regardless of whether the TypeScript support
375
+ * is detected or not. This effectively means using `entitiesTs` for discovery and `pathTs` for migrations and
376
+ * seeders. Should be used only for tests and stay disabled for production builds.
377
+ */
378
+ preferTs?: boolean;
379
+ /** @deprecated use `preferTs` instead */
373
380
  tsNode?: boolean;
374
381
  baseDir: string;
375
382
  migrations: MigrationsOptions;
@@ -145,6 +145,7 @@ class Configuration {
145
145
  }
146
146
  this.options = Utils_1.Utils.mergeConfig({}, Configuration.DEFAULTS, options);
147
147
  this.options.baseDir = Utils_1.Utils.absolutePath(this.options.baseDir);
148
+ this.options.preferTs ??= options.tsNode;
148
149
  if (validate) {
149
150
  this.validateOptions();
150
151
  }
@@ -330,6 +331,7 @@ class Configuration {
330
331
  }
331
332
  sync() {
332
333
  process.env.MIKRO_ORM_COLORS = '' + this.options.colors;
334
+ this.options.tsNode = this.options.preferTs;
333
335
  this.logger.setDebugMode(this.options.debug);
334
336
  }
335
337
  /**