@mikro-orm/cli 7.1.16-dev.4 → 7.1.16-dev.5
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 +19 -1
- package/package.json +3 -3
package/CLIHelper.js
CHANGED
|
@@ -280,6 +280,7 @@ export class CLIHelper {
|
|
|
280
280
|
jiti: { cjs: 'jiti/register', cb: setEsmImportProvider },
|
|
281
281
|
tsimp: { cjs: 'tsimp/import', cb: setEsmImportProvider },
|
|
282
282
|
};
|
|
283
|
+
const errors = [];
|
|
283
284
|
for (const loader of Utils.keys(loaders)) {
|
|
284
285
|
if (explicitLoader !== 'auto' && loader !== explicitLoader) {
|
|
285
286
|
continue;
|
|
@@ -287,13 +288,30 @@ export class CLIHelper {
|
|
|
287
288
|
const { esm, cjs, cb } = loaders[loader];
|
|
288
289
|
const isEsm = this.isESM();
|
|
289
290
|
const module = isEsm && esm ? esm : cjs;
|
|
290
|
-
|
|
291
|
+
let mod;
|
|
292
|
+
try {
|
|
293
|
+
mod = await Utils.tryImport({ module });
|
|
294
|
+
}
|
|
295
|
+
catch (e) {
|
|
296
|
+
const error = new Error(`Failed to load TypeScript loader \`${loader}\` (${module}): ${e.message}`, {
|
|
297
|
+
cause: e,
|
|
298
|
+
});
|
|
299
|
+
if (explicitLoader !== 'auto') {
|
|
300
|
+
throw error;
|
|
301
|
+
}
|
|
302
|
+
errors.push(error);
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
291
305
|
if (mod) {
|
|
292
306
|
cb?.(mod);
|
|
293
307
|
process.env.MIKRO_ORM_CLI_TS_LOADER = loader;
|
|
294
308
|
return true;
|
|
295
309
|
}
|
|
296
310
|
}
|
|
311
|
+
// a loader that is installed but broken is a real problem, not a missing dependency
|
|
312
|
+
if (errors.length > 0) {
|
|
313
|
+
throw new Error(errors.map(e => e.message).join('\n'), { cause: errors[0] });
|
|
314
|
+
}
|
|
297
315
|
// eslint-disable-next-line no-console
|
|
298
316
|
console.warn('Neither `oxc`, `swc`, `tsx`, `jiti` nor `tsimp` found in the project dependencies, support for working with TypeScript files might not work. To use `oxc`, install `@oxc-node/core`. To use `swc`, install both `@swc-node/register` and `@swc/core`.');
|
|
299
317
|
return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/cli",
|
|
3
|
-
"version": "7.1.16-dev.
|
|
3
|
+
"version": "7.1.16-dev.5",
|
|
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
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"copy": "node ../../scripts/copy.mjs"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@mikro-orm/core": "7.1.16-dev.
|
|
54
|
-
"mikro-orm": "7.1.16-dev.
|
|
53
|
+
"@mikro-orm/core": "7.1.16-dev.5",
|
|
54
|
+
"mikro-orm": "7.1.16-dev.5",
|
|
55
55
|
"yargs": "17.7.2"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|