@mikro-orm/cli 7.0.0-dev.107 → 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.
- package/CLIHelper.js +10 -9
- package/commands/DebugCommand.js +3 -3
- package/package.json +3 -3
package/CLIHelper.js
CHANGED
|
@@ -91,7 +91,7 @@ export class CLIHelper {
|
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
/* v8 ignore next */
|
|
94
|
-
|
|
94
|
+
globalThis.dynamicImportProvider = options.dynamicImportProvider ??= id => {
|
|
95
95
|
id = fileURLToPath(id);
|
|
96
96
|
return createRequire(process.cwd())(id);
|
|
97
97
|
};
|
|
@@ -174,10 +174,10 @@ export class CLIHelper {
|
|
|
174
174
|
}
|
|
175
175
|
static async getConfigFile(paths) {
|
|
176
176
|
for (let path of paths) {
|
|
177
|
-
path =
|
|
178
|
-
path =
|
|
177
|
+
path = fs.absolutePath(path);
|
|
178
|
+
path = fs.normalizePath(path);
|
|
179
179
|
if (fs.pathExists(path)) {
|
|
180
|
-
const config = await
|
|
180
|
+
const config = await fs.dynamicImport(path);
|
|
181
181
|
/* v8 ignore next */
|
|
182
182
|
return [path, await (config.default ?? config)];
|
|
183
183
|
}
|
|
@@ -250,7 +250,7 @@ export class CLIHelper {
|
|
|
250
250
|
if (!extname(from)) {
|
|
251
251
|
from = join(from, '__fake.js');
|
|
252
252
|
}
|
|
253
|
-
const path =
|
|
253
|
+
const path = fs.normalizePath(import.meta.resolve(id, pathToFileURL(from)));
|
|
254
254
|
const parts = path.split('/');
|
|
255
255
|
const idx = parts.lastIndexOf(id) + 1;
|
|
256
256
|
parts.splice(idx, parts.length - idx);
|
|
@@ -294,8 +294,10 @@ export class CLIHelper {
|
|
|
294
294
|
const loaders = {
|
|
295
295
|
swc: { esm: '@swc-node/register/esm-register', cjs: '@swc-node/register' },
|
|
296
296
|
tsx: { esm: 'tsx/esm/api', cjs: 'tsx/cjs/api', cb: (tsx) => tsx.register({ tsconfig: configPath }) },
|
|
297
|
-
jiti: {
|
|
298
|
-
|
|
297
|
+
jiti: { cjs: 'jiti/register', cb: () => {
|
|
298
|
+
return globalThis.dynamicImportProvider = (id) => import(id).then(mod => mod?.default ?? mod);
|
|
299
|
+
} },
|
|
300
|
+
tsimp: { cjs: 'tsimp/import' },
|
|
299
301
|
};
|
|
300
302
|
for (const loader of Utils.keys(loaders)) {
|
|
301
303
|
if (explicitLoader !== 'auto' && loader !== explicitLoader) {
|
|
@@ -303,8 +305,7 @@ export class CLIHelper {
|
|
|
303
305
|
}
|
|
304
306
|
const { esm, cjs, cb } = loaders[loader];
|
|
305
307
|
const isEsm = this.isESM();
|
|
306
|
-
|
|
307
|
-
const module = isEsm ? esm : cjs;
|
|
308
|
+
const module = isEsm && esm ? esm : cjs;
|
|
308
309
|
const mod = await Utils.tryImport({ module });
|
|
309
310
|
if (mod) {
|
|
310
311
|
cb?.(mod);
|
package/commands/DebugCommand.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { colors
|
|
1
|
+
import { colors } from '@mikro-orm/core';
|
|
2
2
|
import { fs } from '@mikro-orm/core/fs-utils';
|
|
3
3
|
import { CLIHelper } from '../CLIHelper.js';
|
|
4
4
|
export class DebugCommand {
|
|
@@ -67,8 +67,8 @@ export class DebugCommand {
|
|
|
67
67
|
}
|
|
68
68
|
static async checkPaths(paths, failedColor, baseDir) {
|
|
69
69
|
for (let path of paths) {
|
|
70
|
-
path =
|
|
71
|
-
path =
|
|
70
|
+
path = fs.absolutePath(path, baseDir);
|
|
71
|
+
path = fs.normalizePath(path);
|
|
72
72
|
if (fs.pathExists(path)) {
|
|
73
73
|
CLIHelper.dump(` - ${path} (${colors.green('found')})`);
|
|
74
74
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.0.0-dev.
|
|
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",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.0.0-dev.
|
|
57
|
-
"mikro-orm": "7.0.0-dev.
|
|
56
|
+
"@mikro-orm/core": "7.0.0-dev.108",
|
|
57
|
+
"mikro-orm": "7.0.0-dev.108",
|
|
58
58
|
"yargs": "17.7.2"
|
|
59
59
|
}
|
|
60
60
|
}
|