@shohojdhara/atomix 0.5.7 → 0.5.8

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/index.esm.js CHANGED
@@ -21427,8 +21427,10 @@ function validateConfig$1(config) {
21427
21427
  * Helper function to load config from a specific path
21428
21428
  */ function loadConfigAtPath(path, required, defaultConfig) {
21429
21429
  try {
21430
- // Use dynamic import for ESM compatibility
21431
- const configModule = require(path), config = configModule.default || configModule;
21430
+ // Use dynamic requirement to hide from bundlers
21431
+ const req = "undefined" != typeof require ? require : void 0;
21432
+ if (!req) return defaultConfig;
21433
+ const configModule = req(path), config = configModule.default || configModule;
21432
21434
  // Validate it's an AtomixConfig
21433
21435
  if (config && "object" == typeof config) return config;
21434
21436
  throw new Error("Invalid config format");
@@ -21452,10 +21454,19 @@ function validateConfig$1(config) {
21452
21454
  */ function resolveConfigPath(configPath) {
21453
21455
  // In browser environments, config resolution is not possible
21454
21456
  if ("undefined" != typeof window) return null;
21455
- // eslint-disable-next-line @typescript-eslint/no-var-requires
21456
- const {existsSync: existsSync} = require("fs"), {join: join} = require("path");
21457
- // eslint-disable-next-line @typescript-eslint/no-var-requires
21458
- // If a specific config path is provided, check if it exists
21457
+ // Use dynamic requirement to hide from bundlers like Turbopack/Webpack
21458
+ let nodeFs, nodePath;
21459
+ try {
21460
+ // Using a dynamic string and eval-like approach to prevent static analysis
21461
+ // This is safe here because we've already checked for window (browser)
21462
+ const req = "undefined" != typeof require ? require : void 0;
21463
+ req && (nodeFs = req([ "f", "s" ].join("")), nodePath = req([ "p", "a", "t", "h" ].join("")));
21464
+ } catch (e) {
21465
+ return null;
21466
+ }
21467
+ if (!nodeFs || !nodePath) return null;
21468
+ const {existsSync: existsSync} = nodeFs, {join: join} = nodePath;
21469
+ // If a specific config path is provided, check if it exists
21459
21470
  if (configPath) {
21460
21471
  const absPath = join(process.cwd(), configPath);
21461
21472
  return existsSync(absPath) ? absPath : null;
@@ -21516,7 +21527,9 @@ function validateConfig$1(config) {
21516
21527
  let loadAtomixConfig;
21517
21528
  try {
21518
21529
  // eslint-disable-next-line @typescript-eslint/no-var-requires
21519
- const {loadAtomixConfig: loader} = require("../../config/loader");
21530
+ const req = "undefined" != typeof require ? require : void 0;
21531
+ if (!req) throw new Error("require is not available");
21532
+ const {loadAtomixConfig: loader} = req("../../config/loader");
21520
21533
  loadAtomixConfig = loader;
21521
21534
  } catch (error) {
21522
21535
  throw new Error("Config loader module not available");