@mikro-orm/core 7.0.0-dev.85 → 7.0.0-dev.86

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
@@ -18,17 +18,17 @@ export async function lookupExtensions(options) {
18
18
  const extensions = options.extensions ?? [];
19
19
  const exists = (name) => extensions.some(ext => ext.name === name);
20
20
  if (!exists('SeedManager')) {
21
- await registerExtension('SeedManager', import('@mikro-orm/seeder' + ''), extensions);
21
+ await registerExtension('SeedManager', import((() => '@mikro-orm/seeder')()), extensions);
22
22
  }
23
23
  if (!exists('Migrator')) {
24
- await registerExtension('Migrator', import('@mikro-orm/migrations' + ''), extensions);
24
+ await registerExtension('Migrator', import((() => '@mikro-orm/migrations')()), extensions);
25
25
  }
26
26
  /* v8 ignore if */
27
27
  if (!exists('Migrator')) {
28
- await registerExtension('Migrator', import('@mikro-orm/migrations-mongodb' + ''), extensions);
28
+ await registerExtension('Migrator', import((() => '@mikro-orm/migrations-mongodb')()), extensions);
29
29
  }
30
30
  if (!exists('EntityGenerator')) {
31
- await registerExtension('EntityGenerator', import('@mikro-orm/entity-generator' + ''), extensions);
31
+ await registerExtension('EntityGenerator', import((() => '@mikro-orm/entity-generator')()), extensions);
32
32
  }
33
33
  options.extensions = extensions;
34
34
  const metadataCacheEnabled = options.metadataCache?.enabled || options.metadataProvider?.useCache?.();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
3
  "type": "module",
4
- "version": "7.0.0-dev.85",
4
+ "version": "7.0.0-dev.86",
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",
@@ -216,7 +216,7 @@ export class DataloaderUtils {
216
216
  return this.DataLoader;
217
217
  }
218
218
  try {
219
- const mod = await import('dataloader' + '');
219
+ const mod = await import('dataloader');
220
220
  const DataLoader = mod.default;
221
221
  return (this.DataLoader ??= DataLoader);
222
222
  }
@@ -4,9 +4,9 @@ export declare const fs: {
4
4
  ensureDir(path: string): void;
5
5
  readJSONSync<T = Dictionary>(path: string): T;
6
6
  glob(input: string | string[], cwd?: string): string[];
7
- getPackageConfig<T extends Dictionary>(basePath?: string): Promise<T>;
8
- getORMPackages(): Promise<Set<string>>;
7
+ getPackageConfig<T extends Dictionary>(basePath?: string): T;
8
+ getORMPackages(): Set<string>;
9
9
  getORMPackageVersion(name: string): string | undefined;
10
- checkPackageVersion(): Promise<void>;
10
+ checkPackageVersion(): void;
11
11
  };
12
12
  export * from '../cache/FileCacheAdapter.js';
package/utils/fs-utils.js CHANGED
@@ -39,10 +39,11 @@ export const fs = {
39
39
  const files = globSync(input, { cwd, withFileTypes: true });
40
40
  return files.filter(f => f.isFile()).map(f => join(f.parentPath, f.name));
41
41
  },
42
- async getPackageConfig(basePath = process.cwd()) {
42
+ getPackageConfig(basePath = process.cwd()) {
43
43
  if (this.pathExists(`${basePath}/package.json`)) {
44
44
  try {
45
- return await Utils.dynamicImport(`${basePath}/package.json`);
45
+ const path = import.meta.resolve(`${basePath}/package.json`);
46
+ return this.readJSONSync(fileURLToPath(path));
46
47
  }
47
48
  catch (e) {
48
49
  /* v8 ignore next */
@@ -56,8 +57,8 @@ export const fs = {
56
57
  }
57
58
  return this.getPackageConfig(parentFolder);
58
59
  },
59
- async getORMPackages() {
60
- const pkg = await this.getPackageConfig();
60
+ getORMPackages() {
61
+ const pkg = this.getPackageConfig();
61
62
  return new Set([
62
63
  ...Object.keys(pkg.dependencies ?? {}),
63
64
  ...Object.keys(pkg.devDependencies ?? {}),
@@ -74,12 +75,12 @@ export const fs = {
74
75
  }
75
76
  },
76
77
  // inspired by https://github.com/facebook/docusaurus/pull/3386
77
- async checkPackageVersion() {
78
+ checkPackageVersion() {
78
79
  const coreVersion = Utils.getORMVersion();
79
80
  if (process.env.MIKRO_ORM_ALLOW_VERSION_MISMATCH || coreVersion === '[[MIKRO_ORM_VERSION]]') {
80
81
  return;
81
82
  }
82
- const deps = await this.getORMPackages();
83
+ const deps = this.getORMPackages();
83
84
  const exceptions = new Set(['nestjs', 'sql-highlighter', 'mongo-highlighter']);
84
85
  const ormPackages = [...deps].filter(d => d.startsWith('@mikro-orm/') && d !== '@mikro-orm/core' && !exceptions.has(d.substring('@mikro-orm/'.length)));
85
86
  for (const ormPackage of ormPackages) {