@theunwalked/cardigantime 0.0.21 → 0.0.22

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.
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const yaml = require('js-yaml');
6
- const path = require('path');
7
- const fs = require('fs');
6
+ const path = require('node:path');
7
+ const fs = require('node:fs');
8
8
  const glob = require('glob');
9
- const crypto = require('crypto');
9
+ const crypto = require('node:crypto');
10
10
  const zod = require('zod');
11
11
 
12
12
  function _interopNamespaceDefault(e) {
@@ -29,6 +29,7 @@ function _interopNamespaceDefault(e) {
29
29
  const yaml__namespace = /*#__PURE__*/_interopNamespaceDefault(yaml);
30
30
  const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
31
31
  const fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
32
+ const crypto__namespace = /*#__PURE__*/_interopNamespaceDefault(crypto);
32
33
 
33
34
  function _define_property$2(obj, key, value) {
34
35
  if (key in obj) {
@@ -273,7 +274,6 @@ function _define_property$1(obj, key, value) {
273
274
  }
274
275
  }
275
276
 
276
- // eslint-disable-next-line no-restricted-imports
277
277
  const create$1 = (params)=>{
278
278
  // eslint-disable-next-line no-console
279
279
  const log = params.log || console.log;
@@ -385,7 +385,7 @@ const create$1 = (params)=>{
385
385
  nodir: true
386
386
  });
387
387
  for (const file of files){
388
- await callback(path.join(directory, file));
388
+ await callback(path__namespace.join(directory, file));
389
389
  }
390
390
  } catch (err) {
391
391
  throw FileSystemError.operationFailed(`glob pattern ${options.pattern}`, directory, err);
@@ -396,7 +396,7 @@ const create$1 = (params)=>{
396
396
  };
397
397
  const hashFile = async (path, length)=>{
398
398
  const file = await readFile(path, 'utf8');
399
- return crypto.createHash('sha256').update(file).digest('hex').slice(0, length);
399
+ return crypto__namespace.createHash('sha256').update(file).digest('hex').slice(0, length);
400
400
  };
401
401
  const listFiles = async (directory)=>{
402
402
  return await fs__namespace.promises.readdir(directory);
@@ -482,10 +482,10 @@ function setNestedValue$1(obj, path, value) {
482
482
  /**
483
483
  * Resolves a single path string relative to the config directory if it's a relative path.
484
484
  */ function resolveSinglePath$1(pathStr, configDir) {
485
- if (!pathStr || path.isAbsolute(pathStr)) {
485
+ if (!pathStr || path__namespace.isAbsolute(pathStr)) {
486
486
  return pathStr;
487
487
  }
488
- return path.resolve(configDir, pathStr);
488
+ return path__namespace.resolve(configDir, pathStr);
489
489
  }
490
490
  /**
491
491
  * Discovers configuration directories by traversing up the directory tree.
@@ -516,19 +516,19 @@ function setNestedValue$1(obj, path, value) {
516
516
  log: (logger === null || logger === void 0 ? void 0 : logger.debug) || (()=>{})
517
517
  });
518
518
  const discoveredDirs = [];
519
- let currentDir = path.resolve(startingDir);
519
+ let currentDir = path__namespace.resolve(startingDir);
520
520
  let level = 0;
521
521
  const visited = new Set(); // Prevent infinite loops with symlinks
522
522
  logger === null || logger === void 0 ? void 0 : logger.debug(`Starting hierarchical discovery from: ${currentDir}`);
523
523
  while(level < maxLevels){
524
524
  // Prevent infinite loops with symlinks
525
- const realPath = path.resolve(currentDir);
525
+ const realPath = path__namespace.resolve(currentDir);
526
526
  if (visited.has(realPath)) {
527
527
  logger === null || logger === void 0 ? void 0 : logger.debug(`Already visited ${realPath}, stopping discovery`);
528
528
  break;
529
529
  }
530
530
  visited.add(realPath);
531
- const configDirPath = path.join(currentDir, configDirName);
531
+ const configDirPath = path__namespace.join(currentDir, configDirName);
532
532
  logger === null || logger === void 0 ? void 0 : logger.debug(`Checking for config directory: ${configDirPath}`);
533
533
  try {
534
534
  const exists = await storage.exists(configDirPath);
@@ -546,7 +546,7 @@ function setNestedValue$1(obj, path, value) {
546
546
  logger === null || logger === void 0 ? void 0 : logger.debug(`Error checking config directory ${configDirPath}: ${error.message}`);
547
547
  }
548
548
  // Move up one directory level
549
- const parentDir = path.dirname(currentDir);
549
+ const parentDir = path__namespace.dirname(currentDir);
550
550
  // Check if we've reached the root directory
551
551
  if (parentDir === currentDir) {
552
552
  logger === null || logger === void 0 ? void 0 : logger.debug('Reached filesystem root, stopping discovery');
@@ -567,7 +567,7 @@ function setNestedValue$1(obj, path, value) {
567
567
  * @param logger Optional logger for debugging
568
568
  * @returns Promise resolving to the found config file path or null if not found
569
569
  */ async function findConfigFileWithExtension$1(storage, configDir, configFileName, logger) {
570
- const configFilePath = path.join(configDir, configFileName);
570
+ const configFilePath = path__namespace.join(configDir, configFileName);
571
571
  // First try the exact filename as specified
572
572
  const exists = await storage.exists(configFilePath);
573
573
  if (exists) {
@@ -578,11 +578,11 @@ function setNestedValue$1(obj, path, value) {
578
578
  }
579
579
  // If the exact filename doesn't exist or isn't readable, try alternative extensions
580
580
  // Only do this if the filename has a .yaml or .yml extension
581
- const ext = path.extname(configFileName);
581
+ const ext = path__namespace.extname(configFileName);
582
582
  if (ext === '.yaml' || ext === '.yml') {
583
- const baseName = path.basename(configFileName, ext);
583
+ const baseName = path__namespace.basename(configFileName, ext);
584
584
  const alternativeExt = ext === '.yaml' ? '.yml' : '.yaml';
585
- const alternativePath = path.join(configDir, baseName + alternativeExt);
585
+ const alternativePath = path__namespace.join(configDir, baseName + alternativeExt);
586
586
  logger === null || logger === void 0 ? void 0 : logger.debug(`Config file not found at ${configFilePath}, trying alternative: ${alternativePath}`);
587
587
  const altExists = await storage.exists(alternativePath);
588
588
  if (altExists) {
@@ -610,11 +610,11 @@ function setNestedValue$1(obj, path, value) {
610
610
  log: (logger === null || logger === void 0 ? void 0 : logger.debug) || (()=>{})
611
611
  });
612
612
  try {
613
- logger === null || logger === void 0 ? void 0 : logger.verbose(`Attempting to load config file: ${path.join(configDir, configFileName)}`);
613
+ logger === null || logger === void 0 ? void 0 : logger.verbose(`Attempting to load config file: ${path__namespace.join(configDir, configFileName)}`);
614
614
  // Try to find the config file with alternative extensions
615
615
  const configFilePath = await findConfigFileWithExtension$1(storage, configDir, configFileName, logger);
616
616
  if (!configFilePath) {
617
- logger === null || logger === void 0 ? void 0 : logger.debug(`Config file does not exist: ${path.join(configDir, configFileName)}`);
617
+ logger === null || logger === void 0 ? void 0 : logger.debug(`Config file does not exist: ${path__namespace.join(configDir, configFileName)}`);
618
618
  return null;
619
619
  }
620
620
  const yamlContent = await storage.readFile(configFilePath, encoding);
@@ -632,7 +632,7 @@ function setNestedValue$1(obj, path, value) {
632
632
  return null;
633
633
  }
634
634
  } catch (error) {
635
- logger === null || logger === void 0 ? void 0 : logger.debug(`Error loading config from ${path.join(configDir, configFileName)}: ${error.message}`);
635
+ logger === null || logger === void 0 ? void 0 : logger.debug(`Error loading config from ${path__namespace.join(configDir, configFileName)}: ${error.message}`);
636
636
  return null;
637
637
  }
638
638
  }