better-dx 0.2.20 โ†’ 0.2.21

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/index.js +73 -66
  3. package/package.json +12 -12
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ [Compare changes](https://github.com/stacksjs/better-dx/compare/v0.2.20...v0.2.21)
2
+
3
+ ## ๐Ÿ“ Documentation
4
+
5
+ - repair tool workflow formatting ([7a86ab9](https://github.com/stacksjs/better-dx/commit/7a86ab9)) _(by Chris <chrisbreuer93@gmail.com>)_
6
+
7
+ ## ๐Ÿ”ง Chores
8
+
9
+ - release v0.2.21 ([88957a6](https://github.com/stacksjs/better-dx/commit/88957a6)) _(by Chris <chrisbreuer93@gmail.com>)_
10
+ - **deps**: update bumpx to 0.2.14 ([d28ecfe](https://github.com/stacksjs/better-dx/commit/d28ecfe)) _(by Chris <chrisbreuer93@gmail.com>)_
11
+ - **deps**: update development toolchain ([2e25562](https://github.com/stacksjs/better-dx/commit/2e25562)) _(by Chris <chrisbreuer93@gmail.com>)_
12
+
13
+ ## Contributors
14
+
15
+ - _Chris <chrisbreuer93@gmail.com>_
16
+
1
17
  [Compare changes](https://github.com/stacksjs/better-dx/compare/v0.2.19...v0.2.20)
2
18
 
3
19
  ## ๐Ÿงน Chores
package/dist/index.js CHANGED
@@ -3,26 +3,28 @@ var __require = import.meta.require;
3
3
 
4
4
  // node_modules/bunfig/dist/index.js
5
5
  import { existsSync, statSync } from "fs";
6
+ import { resolve } from "path";
7
+ import process from "process";
6
8
  import { existsSync as existsSync13, mkdirSync as mkdirSync4, readdirSync as readdirSync4, readFileSync, writeFileSync as writeFileSync7 } from "fs";
7
9
  import { homedir as homedir3 } from "os";
8
10
  import { dirname as dirname4, resolve as resolve12 } from "path";
9
11
  import process20 from "process";
10
- import { existsSync as existsSync2, statSync as statSync2 } from "fs";
12
+ import { existsSync as existsSync3, statSync as statSync2 } from "fs";
11
13
  import { existsSync as existsSync8, mkdirSync as mkdirSync3, readdirSync as readdirSync3, writeFileSync as writeFileSync5 } from "fs";
12
14
  import { homedir as homedir2 } from "os";
13
15
  import { dirname as dirname3, resolve as resolve7 } from "path";
14
16
  import process12 from "process";
15
17
  import { join as join3, relative as relative2, resolve as resolve4 } from "path";
16
18
  import process7 from "process";
17
- import { existsSync as existsSync3, mkdirSync as mkdirSync2, readdirSync as readdirSync2, writeFileSync as writeFileSync3 } from "fs";
19
+ import { existsSync as existsSync32, mkdirSync as mkdirSync2, readdirSync as readdirSync2, writeFileSync as writeFileSync3 } from "fs";
18
20
  import { homedir } from "os";
19
21
  import { dirname as dirname2, resolve as resolve3 } from "path";
20
22
  import process6 from "process";
21
23
  import { join, relative, resolve as resolve2 } from "path";
22
24
  import process2 from "process";
23
25
  import { existsSync as existsSync22, mkdirSync, readdirSync, writeFileSync } from "fs";
24
- import { dirname, resolve } from "path";
25
- import process from "process";
26
+ import { dirname, resolve as resolve5 } from "path";
27
+ import process3 from "process";
26
28
  import { Buffer } from "buffer";
27
29
  import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
28
30
  import { closeSync, createReadStream, createWriteStream, existsSync as existsSync222, fsyncSync, openSync, writeFileSync as writeFileSync2 } from "fs";
@@ -32,7 +34,7 @@ import process5 from "process";
32
34
  import { pipeline } from "stream/promises";
33
35
  import { createGzip } from "zlib";
34
36
  import process4 from "process";
35
- import process3 from "process";
37
+ import process32 from "process";
36
38
  import { Buffer as Buffer2 } from "buffer";
37
39
  import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv2, randomBytes as randomBytes2 } from "crypto";
38
40
  import { closeSync as closeSync2, createReadStream as createReadStream2, createWriteStream as createWriteStream2, existsSync as existsSync4, fsyncSync as fsyncSync2, openSync as openSync2, writeFileSync as writeFileSync4 } from "fs";
@@ -45,7 +47,7 @@ import process10 from "process";
45
47
  import process9 from "process";
46
48
  import process8 from "process";
47
49
  import { existsSync as existsSync5 } from "fs";
48
- import { resolve as resolve5 } from "path";
50
+ import { resolve as resolve52 } from "path";
49
51
  import { existsSync as existsSync7 } from "fs";
50
52
  import { existsSync as existsSync9, readdirSync as readdirSync5 } from "fs";
51
53
  import { extname, resolve as resolve8 } from "path";
@@ -306,6 +308,43 @@ class PerformanceMonitor {
306
308
  }
307
309
  var globalCache = new ConfigCache;
308
310
  var globalPerformanceMonitor = new PerformanceMonitor;
311
+ var CONFIG_FILE_EXTENSIONS = [
312
+ ".ts",
313
+ ".js",
314
+ ".mjs",
315
+ ".cjs",
316
+ ".json",
317
+ ".mts",
318
+ ".cts"
319
+ ];
320
+ function getConfigNamePatterns(options = {}) {
321
+ const { name = "", alias } = options;
322
+ const patterns = ["config", ".config"];
323
+ if (name)
324
+ patterns.push(name, `.${name}.config`, `${name}.config`, `.${name}`);
325
+ const aliases = alias === undefined ? [] : Array.isArray(alias) ? alias : [alias];
326
+ for (const alternative of aliases) {
327
+ if (!alternative)
328
+ continue;
329
+ patterns.push(alternative, `.${alternative}.config`, `${alternative}.config`, `.${alternative}`);
330
+ if (name)
331
+ patterns.push(`${name}.${alternative}.config`, `.${name}.${alternative}.config`);
332
+ }
333
+ return Array.from(new Set(patterns.filter(Boolean)));
334
+ }
335
+ function getConfigPaths(options) {
336
+ const patterns = getConfigNamePatterns(options);
337
+ return patterns.flatMap((pattern) => CONFIG_FILE_EXTENSIONS.map((extension) => resolve(options.directory, `${pattern}${extension}`)));
338
+ }
339
+ function getLocalConfigDirectories(options = {}) {
340
+ const cwd = resolve(options.cwd || process.cwd());
341
+ return Array.from(new Set([
342
+ cwd,
343
+ resolve(cwd, "config"),
344
+ resolve(cwd, ".config"),
345
+ options.configDir ? resolve(cwd, options.configDir) : undefined
346
+ ].filter((directory) => Boolean(directory))));
347
+ }
309
348
  var __defProp = Object.defineProperty;
310
349
  var __returnValue = (v) => v;
311
350
  function __exportSetter(name, newValue) {
@@ -443,7 +482,7 @@ class ConfigCache2 {
443
482
  }
444
483
  isFileModified(configPath, cachedTimestamp) {
445
484
  try {
446
- if (!existsSync2(configPath)) {
485
+ if (!existsSync3(configPath)) {
447
486
  return true;
448
487
  }
449
488
  const stats = statSync2(configPath);
@@ -465,7 +504,7 @@ class ConfigCache2 {
465
504
  }
466
505
  setWithFileCheck(configName, value, configPath, customTtl) {
467
506
  try {
468
- const stats = existsSync2(configPath) ? statSync2(configPath) : null;
507
+ const stats = existsSync3(configPath) ? statSync2(configPath) : null;
469
508
  const fileTimestamp = stats ? stats.mtime : new Date;
470
509
  this.set(configName, { value, fileTimestamp }, configPath, customTtl);
471
510
  } catch {
@@ -765,7 +804,7 @@ async function loadConfig({
765
804
  cwd,
766
805
  defaultConfig
767
806
  }) {
768
- const baseDir = cwd || process.cwd();
807
+ const baseDir = cwd || process3.cwd();
769
808
  const extensions = [".ts", ".js", ".mjs", ".cjs", ".json"];
770
809
  const configPaths = [
771
810
  `${name}.config`,
@@ -775,7 +814,7 @@ async function loadConfig({
775
814
  ];
776
815
  for (const configPath of configPaths) {
777
816
  for (const ext of extensions) {
778
- const fullPath = resolve(baseDir, `${configPath}${ext}`);
817
+ const fullPath = resolve5(baseDir, `${configPath}${ext}`);
779
818
  const config2 = await tryLoadConfig(fullPath, defaultConfig);
780
819
  if (config2 !== null) {
781
820
  return config2;
@@ -783,7 +822,7 @@ async function loadConfig({
783
822
  }
784
823
  }
785
824
  try {
786
- const pkgPath = resolve(baseDir, "package.json");
825
+ const pkgPath = resolve5(baseDir, "package.json");
787
826
  if (existsSync22(pkgPath)) {
788
827
  const pkg = await import(pkgPath);
789
828
  const pkgConfig = pkg[name];
@@ -820,24 +859,24 @@ async function loadConfig2() {
820
859
  }
821
860
  }
822
861
  function isBrowserProcess() {
823
- if (process3.env.NODE_ENV === "test" || process3.env.BUN_ENV === "test") {
862
+ if (process32.env.NODE_ENV === "test" || process32.env.BUN_ENV === "test") {
824
863
  return false;
825
864
  }
826
865
  return typeof window !== "undefined";
827
866
  }
828
867
  async function isServerProcess() {
829
- if (process3.env.NODE_ENV === "test" || process3.env.BUN_ENV === "test") {
868
+ if (process32.env.NODE_ENV === "test" || process32.env.BUN_ENV === "test") {
830
869
  return true;
831
870
  }
832
871
  if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
833
872
  return true;
834
873
  }
835
- if (typeof process3 !== "undefined") {
836
- const type = process3.type;
874
+ if (typeof process32 !== "undefined") {
875
+ const type = process32.type;
837
876
  if (type === "renderer" || type === "worker") {
838
877
  return false;
839
878
  }
840
- return !!(process3.versions && (process3.versions.node || process3.versions.bun));
879
+ return !!(process32.versions && (process32.versions.node || process32.versions.bun));
841
880
  }
842
881
  return false;
843
882
  }
@@ -2152,7 +2191,7 @@ function isObject2(item) {
2152
2191
  return Boolean(item && typeof item === "object" && !Array.isArray(item));
2153
2192
  }
2154
2193
  async function tryLoadConfig2(configPath, defaultConfig2, arrayStrategy = "replace") {
2155
- if (!existsSync3(configPath))
2194
+ if (!existsSync32(configPath))
2156
2195
  return null;
2157
2196
  try {
2158
2197
  const importedConfig = await import(configPath);
@@ -2323,7 +2362,7 @@ async function loadConfig3({
2323
2362
  }
2324
2363
  try {
2325
2364
  const pkgPath = resolve3(baseDir, "package.json");
2326
- if (existsSync3(pkgPath)) {
2365
+ if (existsSync32(pkgPath)) {
2327
2366
  const pkg = await import(pkgPath);
2328
2367
  let pkgConfig = pkg[name];
2329
2368
  if (!pkgConfig && alias) {
@@ -2614,7 +2653,7 @@ class Logger2 {
2614
2653
  const errorMessage = typeof error.message === "string" ? error.message : "Unknown error";
2615
2654
  console.error(`Network error during write attempt ${retries + 1}/${maxRetries}:`, errorMessage);
2616
2655
  const delay = backoffDelay * 2 ** retries;
2617
- await new Promise((resolve52) => setTimeout(resolve52, delay));
2656
+ await new Promise((resolve522) => setTimeout(resolve522, delay));
2618
2657
  retries++;
2619
2658
  continue;
2620
2659
  }
@@ -2642,7 +2681,7 @@ class Logger2 {
2642
2681
  }
2643
2682
  retries++;
2644
2683
  const delay = backoffDelay * 2 ** (retries - 1);
2645
- await new Promise((resolve52) => setTimeout(resolve52, delay));
2684
+ await new Promise((resolve522) => setTimeout(resolve522, delay));
2646
2685
  }
2647
2686
  }
2648
2687
  })();
@@ -2772,11 +2811,11 @@ class Logger2 {
2772
2811
  };
2773
2812
  }
2774
2813
  async compressData(data) {
2775
- return new Promise((resolve52, reject) => {
2814
+ return new Promise((resolve522, reject) => {
2776
2815
  const gzip = createGzip2();
2777
2816
  const chunks = [];
2778
2817
  gzip.on("data", (chunk2) => chunks.push(chunk2));
2779
- gzip.on("end", () => resolve52(Buffer2.from(Buffer2.concat(chunks))));
2818
+ gzip.on("end", () => resolve522(Buffer2.from(Buffer2.concat(chunks))));
2780
2819
  gzip.on("error", reject);
2781
2820
  gzip.write(data);
2782
2821
  gzip.end();
@@ -3465,7 +3504,7 @@ class Logger2 {
3465
3504
  if (isBrowserProcess2()) {
3466
3505
  return Promise.resolve(true);
3467
3506
  }
3468
- return new Promise((resolve52) => {
3507
+ return new Promise((resolve522) => {
3469
3508
  console.error(`${styles2.cyan("?")} ${message} (y/n) `);
3470
3509
  const onData = (data) => {
3471
3510
  const input = data.toString().trim().toLowerCase();
@@ -3477,7 +3516,7 @@ class Logger2 {
3477
3516
  } catch {}
3478
3517
  process11.stdin.pause();
3479
3518
  console.error("");
3480
- resolve52(input === "y" || input === "yes");
3519
+ resolve522(input === "y" || input === "yes");
3481
3520
  };
3482
3521
  try {
3483
3522
  if (typeof process11.stdin.setRawMode === "function") {
@@ -3643,7 +3682,7 @@ async function withErrorRecovery(fn, options = {}) {
3643
3682
  break;
3644
3683
  }
3645
3684
  if (retryDelay > 0) {
3646
- await new Promise((resolve52) => setTimeout(resolve52, retryDelay));
3685
+ await new Promise((resolve522) => setTimeout(resolve522, retryDelay));
3647
3686
  }
3648
3687
  }
3649
3688
  }
@@ -4171,7 +4210,7 @@ class ConfigFileLoader {
4171
4210
  const paths = [];
4172
4211
  for (const pattern of patterns) {
4173
4212
  for (const ext of this.extensions) {
4174
- paths.push(resolve5(directory, `${pattern}${ext}`));
4213
+ paths.push(resolve52(directory, `${pattern}${ext}`));
4175
4214
  }
4176
4215
  }
4177
4216
  return paths;
@@ -4208,7 +4247,7 @@ class ConfigFileLoader {
4208
4247
  const patterns = this.generateNamePatterns(configName || "", alias);
4209
4248
  for (const pattern of patterns) {
4210
4249
  for (const ext of this.extensions) {
4211
- const filePath = resolve5(directory, `${pattern}${ext}`);
4250
+ const filePath = resolve52(directory, `${pattern}${ext}`);
4212
4251
  if (await this.checkFileAccess(filePath)) {
4213
4252
  discoveredFiles.push(filePath);
4214
4253
  }
@@ -4220,7 +4259,7 @@ class ConfigFileLoader {
4220
4259
  const files = readdirSync32(directory);
4221
4260
  for (const file of files) {
4222
4261
  if (this.looksLikeConfigFile(file)) {
4223
- const filePath = resolve5(directory, file);
4262
+ const filePath = resolve52(directory, file);
4224
4263
  if (await this.checkFileAccess(filePath)) {
4225
4264
  discoveredFiles.push(filePath);
4226
4265
  }
@@ -5334,8 +5373,8 @@ var init_dist = __esm(async () => {
5334
5373
  isEquivalent: isEquivalent2,
5335
5374
  estimateMemoryUsage: estimateMemoryUsage2
5336
5375
  };
5337
- defaultConfigDir = resolve(process.cwd(), "config");
5338
- defaultGeneratedDir = resolve(process.cwd(), "src/generated");
5376
+ defaultConfigDir = resolve5(process3.cwd(), "config");
5377
+ defaultGeneratedDir = resolve5(process3.cwd(), "src/generated");
5339
5378
  defaultLogDirectory = process2.env.CLARITY_LOG_DIR || join(getProjectRoot(), "logs");
5340
5379
  defaultConfig = {
5341
5380
  level: "info",
@@ -7654,7 +7693,7 @@ function isObject4(item) {
7654
7693
  }
7655
7694
 
7656
7695
  class ConfigFileLoader2 {
7657
- extensions = [".ts", ".js", ".mjs", ".cjs", ".json", ".mts", ".cts"];
7696
+ extensions = CONFIG_FILE_EXTENSIONS;
7658
7697
  async loadFromPath(configPath, defaultConfig4, options = {}) {
7659
7698
  const {
7660
7699
  arrayStrategy = "replace",
@@ -7729,37 +7768,10 @@ class ConfigFileLoader2 {
7729
7768
  return null;
7730
7769
  }
7731
7770
  generateConfigPaths(configName, directory, alias) {
7732
- const patterns = this.generateNamePatterns(configName, alias);
7733
- const paths = [];
7734
- for (const pattern of patterns) {
7735
- for (const ext of this.extensions) {
7736
- paths.push(resolve10(directory, `${pattern}${ext}`));
7737
- }
7738
- }
7739
- return paths;
7771
+ return getConfigPaths({ name: configName, directory, alias });
7740
7772
  }
7741
7773
  generateNamePatterns(configName, alias) {
7742
- const patterns = [];
7743
- patterns.push("config", ".config");
7744
- if (configName) {
7745
- patterns.push(configName, `.${configName}.config`, `${configName}.config`, `.${configName}`);
7746
- }
7747
- const aliases = alias === undefined ? [] : Array.isArray(alias) ? alias : [alias];
7748
- for (const a of aliases) {
7749
- if (!a)
7750
- continue;
7751
- patterns.push(a, `.${a}.config`, `${a}.config`, `.${a}`);
7752
- if (configName) {
7753
- patterns.push(`${configName}.${a}.config`, `.${configName}.${a}.config`);
7754
- }
7755
- }
7756
- const seen = new Set;
7757
- return patterns.filter((p) => {
7758
- if (!p || seen.has(p))
7759
- return false;
7760
- seen.add(p);
7761
- return true;
7762
- });
7774
+ return getConfigNamePatterns({ name: configName, alias });
7763
7775
  }
7764
7776
  checkFileAccess(filePath) {
7765
7777
  return withErrorRecovery2(async () => {
@@ -8551,12 +8563,7 @@ class ConfigLoader2 {
8551
8563
  return keyParts.join("|");
8552
8564
  }
8553
8565
  getLocalDirectories(baseDir, configDir) {
8554
- return Array.from(new Set([
8555
- baseDir,
8556
- resolve12(baseDir, "config"),
8557
- resolve12(baseDir, ".config"),
8558
- configDir ? resolve12(baseDir, configDir) : undefined
8559
- ].filter(Boolean)));
8566
+ return getLocalConfigDirectories({ cwd: baseDir, configDir });
8560
8567
  }
8561
8568
  getAllSearchPaths(name, alias, baseDir, configDir) {
8562
8569
  const paths = [];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "better-dx",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.2.20",
5
+ "version": "0.2.21",
6
6
  "description": "All the development dependencies you need.",
7
7
  "author": "Chris Breuer <chris@stacksjs.org>",
8
8
  "license": "MIT",
@@ -70,19 +70,19 @@
70
70
  "typecheck": "bun --bun tsc --noEmit"
71
71
  },
72
72
  "dependencies": {
73
- "@stacksjs/bumpx": "^0.2.5",
74
- "@stacksjs/bunpress": "^0.1.4",
75
- "@stacksjs/clapp": "^0.2.6",
76
- "@stacksjs/clarity": "^0.3.28",
77
- "@stacksjs/gitlint": "^0.1.5",
78
- "@stacksjs/logsmith": "^0.2.1",
79
- "@types/bun": "^1.3.13",
80
- "buddy-bot": "^0.9.17",
73
+ "@stacksjs/bumpx": "^0.2.14",
74
+ "@stacksjs/bunpress": "^0.1.20",
75
+ "@stacksjs/clapp": "^0.2.12",
76
+ "@stacksjs/clarity": "^0.3.31",
77
+ "@stacksjs/gitlint": "^0.1.7",
78
+ "@stacksjs/logsmith": "^0.2.6",
79
+ "@types/bun": "^1.3.14",
80
+ "buddy-bot": "^0.9.23",
81
81
  "bun-git-hooks": "^0.3.2",
82
82
  "bun-plugin-dtsx": "^0.11.1",
83
- "bunfig": "^0.15.11",
84
- "pickier": "^0.1.28",
85
- "ts-error-handling": "^0.1.1",
83
+ "bunfig": "^0.15.15",
84
+ "pickier": "^0.1.40",
85
+ "ts-error-handling": "^0.1.3",
86
86
  "typescript": "^7.0.2"
87
87
  },
88
88
  "overrides": {