arkormx 2.0.0-next.10 → 2.0.0-next.11

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/dist/cli.mjs CHANGED
@@ -1,18 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
- import * as path from "node:path";
5
4
  import { dirname, extname, join, resolve } from "node:path";
6
5
  import { spawnSync } from "node:child_process";
7
6
  import { str } from "@h3ravel/support";
8
- import { dirname as dirname$1, extname as extname$1, join as join$1, relative } from "path";
7
+ import path, { dirname as dirname$1, extname as extname$1, join as join$1, relative } from "path";
9
8
  import { copyFileSync, existsSync as existsSync$1, mkdirSync as mkdirSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, rmSync as rmSync$1, writeFileSync as writeFileSync$1 } from "fs";
10
9
  import { AsyncLocalStorage } from "async_hooks";
11
10
  import { createJiti } from "@rexxars/jiti";
12
11
  import { pathToFileURL } from "node:url";
12
+ import { createRequire } from "module";
13
13
  import { fileURLToPath } from "url";
14
14
  import { Logger } from "@h3ravel/shared";
15
- import { createRequire } from "module";
16
15
  import { Command, Kernel } from "@h3ravel/musket";
17
16
 
18
17
  //#region src/Exceptions/ArkormException.ts
@@ -1464,18 +1463,14 @@ var RuntimeModuleLoader = class {
1464
1463
  static async load(filePath) {
1465
1464
  const resolvedPath = resolve(filePath);
1466
1465
  return await createJiti(pathToFileURL(resolvedPath).href, {
1467
- fsCache: false,
1468
1466
  interopDefault: false,
1469
- moduleCache: false,
1470
1467
  tsconfigPaths: true
1471
1468
  }).import(resolvedPath);
1472
1469
  }
1473
1470
  static loadSync(filePath) {
1474
1471
  const resolvedPath = resolve(filePath);
1475
1472
  return createJiti(pathToFileURL(resolvedPath).href, {
1476
- fsCache: false,
1477
1473
  interopDefault: false,
1478
- moduleCache: false,
1479
1474
  tsconfigPaths: true
1480
1475
  })(resolvedPath);
1481
1476
  }
package/dist/index.cjs CHANGED
@@ -32,15 +32,15 @@ let async_hooks = require("async_hooks");
32
32
  let _rexxars_jiti = require("@rexxars/jiti");
33
33
  let node_url = require("node:url");
34
34
  let node_path = require("node:path");
35
- node_path = __toESM(node_path);
35
+ let module$1 = require("module");
36
36
  let fs = require("fs");
37
37
  let url = require("url");
38
38
  let node_fs = require("node:fs");
39
39
  let node_crypto = require("node:crypto");
40
40
  let node_child_process = require("node:child_process");
41
41
  let path = require("path");
42
+ path = __toESM(path);
42
43
  let _h3ravel_shared = require("@h3ravel/shared");
43
- let module$1 = require("module");
44
44
  let _h3ravel_musket = require("@h3ravel/musket");
45
45
  let _h3ravel_collect_js = require("@h3ravel/collect.js");
46
46
 
@@ -1025,18 +1025,14 @@ var RuntimeModuleLoader = class {
1025
1025
  static async load(filePath) {
1026
1026
  const resolvedPath = (0, node_path.resolve)(filePath);
1027
1027
  return await (0, _rexxars_jiti.createJiti)((0, node_url.pathToFileURL)(resolvedPath).href, {
1028
- fsCache: false,
1029
1028
  interopDefault: false,
1030
- moduleCache: false,
1031
1029
  tsconfigPaths: true
1032
1030
  }).import(resolvedPath);
1033
1031
  }
1034
1032
  static loadSync(filePath) {
1035
1033
  const resolvedPath = (0, node_path.resolve)(filePath);
1036
1034
  return (0, _rexxars_jiti.createJiti)((0, node_url.pathToFileURL)(resolvedPath).href, {
1037
- fsCache: false,
1038
1035
  interopDefault: false,
1039
- moduleCache: false,
1040
1036
  tsconfigPaths: true
1041
1037
  })(resolvedPath);
1042
1038
  }
@@ -2934,28 +2930,17 @@ const getPersistedEnumTsType = (values) => {
2934
2930
 
2935
2931
  //#endregion
2936
2932
  //#region src/helpers/runtime-config.ts
2937
- const supportedConfigExtensions = [
2938
- "cjs",
2939
- "js",
2940
- "mjs",
2941
- "ts",
2942
- "cts",
2943
- "mts"
2944
- ];
2945
- const getRuntimeConfigPaths = () => {
2946
- return supportedConfigExtensions.map((extension) => node_path.join(process.cwd(), `arkormx.config.${extension}`));
2947
- };
2948
2933
  const resolveDefaultStubsPath = () => {
2949
- let current = node_path.dirname((0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
2934
+ let current = path.default.dirname((0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
2950
2935
  while (true) {
2951
- const packageJsonPath = node_path.join(current, "package.json");
2952
- const stubsPath = node_path.join(current, "stubs");
2936
+ const packageJsonPath = path.default.join(current, "package.json");
2937
+ const stubsPath = path.default.join(current, "stubs");
2953
2938
  if ((0, fs.existsSync)(packageJsonPath) && (0, fs.existsSync)(stubsPath)) return stubsPath;
2954
- const parent = node_path.dirname(current);
2939
+ const parent = path.default.dirname(current);
2955
2940
  if (parent === current) break;
2956
2941
  current = parent;
2957
2942
  }
2958
- return node_path.join(process.cwd(), "stubs");
2943
+ return path.default.join(process.cwd(), "stubs");
2959
2944
  };
2960
2945
  const baseConfig = {
2961
2946
  features: {
@@ -2964,11 +2949,11 @@ const baseConfig = {
2964
2949
  },
2965
2950
  paths: {
2966
2951
  stubs: resolveDefaultStubsPath(),
2967
- seeders: node_path.join(process.cwd(), "database", "seeders"),
2968
- models: node_path.join(process.cwd(), "src", "models"),
2969
- migrations: node_path.join(process.cwd(), "database", "migrations"),
2970
- factories: node_path.join(process.cwd(), "database", "factories"),
2971
- buildOutput: node_path.join(process.cwd(), "dist")
2952
+ seeders: path.default.join(process.cwd(), "database", "seeders"),
2953
+ models: path.default.join(process.cwd(), "src", "models"),
2954
+ migrations: path.default.join(process.cwd(), "database", "migrations"),
2955
+ factories: path.default.join(process.cwd(), "database", "factories"),
2956
+ buildOutput: path.default.join(process.cwd(), "dist")
2972
2957
  },
2973
2958
  outputExt: "ts"
2974
2959
  };
@@ -2988,7 +2973,7 @@ const mergePathConfig = (paths) => {
2988
2973
  const defaults = baseConfig.paths ?? {};
2989
2974
  const current = userConfig.paths ?? {};
2990
2975
  const incoming = Object.entries(paths ?? {}).reduce((all, [key, value]) => {
2991
- if (typeof value === "string" && value.trim().length > 0) all[key] = node_path.isAbsolute(value) ? value : node_path.resolve(process.cwd(), value);
2976
+ if (typeof value === "string" && value.trim().length > 0) all[key] = path.default.isAbsolute(value) ? value : path.default.resolve(process.cwd(), value);
2992
2977
  return all;
2993
2978
  }, {});
2994
2979
  return {
@@ -3104,7 +3089,7 @@ const resolveClient = (resolver) => {
3104
3089
  */
3105
3090
  const resolveAndApplyConfig = (imported) => {
3106
3091
  const config = imported?.default ?? imported;
3107
- if (!config || typeof config !== "object") return false;
3092
+ if (!config || typeof config !== "object") return;
3108
3093
  configureArkormRuntime(config.prisma, {
3109
3094
  adapter: config.adapter,
3110
3095
  boot: config.boot,
@@ -3114,7 +3099,6 @@ const resolveAndApplyConfig = (imported) => {
3114
3099
  outputExt: config.outputExt
3115
3100
  });
3116
3101
  runtimeConfigLoaded = true;
3117
- return true;
3118
3102
  };
3119
3103
  /**
3120
3104
  * Dynamically import a configuration file.
@@ -3127,11 +3111,13 @@ const importConfigFile = (configPath) => {
3127
3111
  return RuntimeModuleLoader.load(configPath);
3128
3112
  };
3129
3113
  const loadRuntimeConfigSync = () => {
3130
- const syncConfigPaths = getRuntimeConfigPaths();
3114
+ const require = (0, module$1.createRequire)(require("url").pathToFileURL(__filename).href);
3115
+ const syncConfigPaths = [path.default.join(process.cwd(), "arkormx.config.cjs")];
3131
3116
  for (const configPath of syncConfigPaths) {
3132
3117
  if (!(0, fs.existsSync)(configPath)) continue;
3133
3118
  try {
3134
- if (resolveAndApplyConfig(RuntimeModuleLoader.loadSync(configPath))) return true;
3119
+ resolveAndApplyConfig(require(configPath));
3120
+ return true;
3135
3121
  } catch {
3136
3122
  continue;
3137
3123
  }
@@ -3146,12 +3132,14 @@ const loadRuntimeConfigSync = () => {
3146
3132
  const loadArkormConfig = async () => {
3147
3133
  if (runtimeConfigLoaded) return;
3148
3134
  if (runtimeConfigLoadingPromise) return await runtimeConfigLoadingPromise;
3135
+ if (loadRuntimeConfigSync()) return;
3149
3136
  runtimeConfigLoadingPromise = (async () => {
3150
- const configPaths = getRuntimeConfigPaths();
3137
+ const configPaths = [path.default.join(process.cwd(), "arkormx.config.js"), path.default.join(process.cwd(), "arkormx.config.ts")];
3151
3138
  for (const configPath of configPaths) {
3152
3139
  if (!(0, fs.existsSync)(configPath)) continue;
3153
3140
  try {
3154
- if (resolveAndApplyConfig(await importConfigFile(configPath))) return;
3141
+ resolveAndApplyConfig(await importConfigFile(configPath));
3142
+ return;
3155
3143
  } catch {
3156
3144
  continue;
3157
3145
  }
@@ -3892,7 +3880,7 @@ var CliApp = class {
3892
3880
  } else candidates.push(mappedFile);
3893
3881
  }
3894
3882
  }
3895
- const runtimeMatch = candidates.find((path$1) => (0, fs.existsSync)(path$1));
3883
+ const runtimeMatch = candidates.find((path$2) => (0, fs.existsSync)(path$2));
3896
3884
  if (runtimeMatch) return runtimeMatch;
3897
3885
  return filePath;
3898
3886
  }
package/dist/index.mjs CHANGED
@@ -3,16 +3,15 @@ import { str } from "@h3ravel/support";
3
3
  import { AsyncLocalStorage } from "async_hooks";
4
4
  import { createJiti } from "@rexxars/jiti";
5
5
  import { pathToFileURL } from "node:url";
6
- import * as path from "node:path";
7
6
  import { dirname, extname, join, resolve } from "node:path";
7
+ import { createRequire } from "module";
8
8
  import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "fs";
9
9
  import { fileURLToPath } from "url";
10
10
  import { existsSync as existsSync$1, mkdirSync as mkdirSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, rmSync as rmSync$1, writeFileSync as writeFileSync$1 } from "node:fs";
11
11
  import { createHash, randomUUID } from "node:crypto";
12
12
  import { spawnSync } from "node:child_process";
13
- import { dirname as dirname$1, extname as extname$1, join as join$1, relative } from "path";
13
+ import path, { dirname as dirname$1, extname as extname$1, join as join$1, relative } from "path";
14
14
  import { Logger } from "@h3ravel/shared";
15
- import { createRequire } from "module";
16
15
  import { Command } from "@h3ravel/musket";
17
16
  import { Collection } from "@h3ravel/collect.js";
18
17
 
@@ -997,18 +996,14 @@ var RuntimeModuleLoader = class {
997
996
  static async load(filePath) {
998
997
  const resolvedPath = resolve(filePath);
999
998
  return await createJiti(pathToFileURL(resolvedPath).href, {
1000
- fsCache: false,
1001
999
  interopDefault: false,
1002
- moduleCache: false,
1003
1000
  tsconfigPaths: true
1004
1001
  }).import(resolvedPath);
1005
1002
  }
1006
1003
  static loadSync(filePath) {
1007
1004
  const resolvedPath = resolve(filePath);
1008
1005
  return createJiti(pathToFileURL(resolvedPath).href, {
1009
- fsCache: false,
1010
1006
  interopDefault: false,
1011
- moduleCache: false,
1012
1007
  tsconfigPaths: true
1013
1008
  })(resolvedPath);
1014
1009
  }
@@ -2906,17 +2901,6 @@ const getPersistedEnumTsType = (values) => {
2906
2901
 
2907
2902
  //#endregion
2908
2903
  //#region src/helpers/runtime-config.ts
2909
- const supportedConfigExtensions = [
2910
- "cjs",
2911
- "js",
2912
- "mjs",
2913
- "ts",
2914
- "cts",
2915
- "mts"
2916
- ];
2917
- const getRuntimeConfigPaths = () => {
2918
- return supportedConfigExtensions.map((extension) => path.join(process.cwd(), `arkormx.config.${extension}`));
2919
- };
2920
2904
  const resolveDefaultStubsPath = () => {
2921
2905
  let current = path.dirname(fileURLToPath(import.meta.url));
2922
2906
  while (true) {
@@ -3076,7 +3060,7 @@ const resolveClient = (resolver) => {
3076
3060
  */
3077
3061
  const resolveAndApplyConfig = (imported) => {
3078
3062
  const config = imported?.default ?? imported;
3079
- if (!config || typeof config !== "object") return false;
3063
+ if (!config || typeof config !== "object") return;
3080
3064
  configureArkormRuntime(config.prisma, {
3081
3065
  adapter: config.adapter,
3082
3066
  boot: config.boot,
@@ -3086,7 +3070,6 @@ const resolveAndApplyConfig = (imported) => {
3086
3070
  outputExt: config.outputExt
3087
3071
  });
3088
3072
  runtimeConfigLoaded = true;
3089
- return true;
3090
3073
  };
3091
3074
  /**
3092
3075
  * Dynamically import a configuration file.
@@ -3099,11 +3082,13 @@ const importConfigFile = (configPath) => {
3099
3082
  return RuntimeModuleLoader.load(configPath);
3100
3083
  };
3101
3084
  const loadRuntimeConfigSync = () => {
3102
- const syncConfigPaths = getRuntimeConfigPaths();
3085
+ const require = createRequire(import.meta.url);
3086
+ const syncConfigPaths = [path.join(process.cwd(), "arkormx.config.cjs")];
3103
3087
  for (const configPath of syncConfigPaths) {
3104
3088
  if (!existsSync(configPath)) continue;
3105
3089
  try {
3106
- if (resolveAndApplyConfig(RuntimeModuleLoader.loadSync(configPath))) return true;
3090
+ resolveAndApplyConfig(require(configPath));
3091
+ return true;
3107
3092
  } catch {
3108
3093
  continue;
3109
3094
  }
@@ -3118,12 +3103,14 @@ const loadRuntimeConfigSync = () => {
3118
3103
  const loadArkormConfig = async () => {
3119
3104
  if (runtimeConfigLoaded) return;
3120
3105
  if (runtimeConfigLoadingPromise) return await runtimeConfigLoadingPromise;
3106
+ if (loadRuntimeConfigSync()) return;
3121
3107
  runtimeConfigLoadingPromise = (async () => {
3122
- const configPaths = getRuntimeConfigPaths();
3108
+ const configPaths = [path.join(process.cwd(), "arkormx.config.js"), path.join(process.cwd(), "arkormx.config.ts")];
3123
3109
  for (const configPath of configPaths) {
3124
3110
  if (!existsSync(configPath)) continue;
3125
3111
  try {
3126
- if (resolveAndApplyConfig(await importConfigFile(configPath))) return;
3112
+ resolveAndApplyConfig(await importConfigFile(configPath));
3113
+ return;
3127
3114
  } catch {
3128
3115
  continue;
3129
3116
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkormx",
3
- "version": "2.0.0-next.10",
3
+ "version": "2.0.0-next.11",
4
4
  "description": "Modern TypeScript-first ORM for Node.js.",
5
5
  "keywords": [
6
6
  "orm",