@stacksjs/router 0.59.8 → 0.59.10

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 (2) hide show
  1. package/dist/index.js +40 -211
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -78887,11 +78887,11 @@ var require_expand = __commonJS((exports, module) => {
78887
78887
  let rangeLimit = options.rangeLimit === undefined ? 1000 : options.rangeLimit;
78888
78888
  let walk3 = (node, parent = {}) => {
78889
78889
  node.queue = [];
78890
- let p3 = parent;
78890
+ let p2 = parent;
78891
78891
  let q2 = parent.queue;
78892
- while (p3.type !== "brace" && p3.type !== "root" && p3.parent) {
78893
- p3 = p3.parent;
78894
- q2 = p3.queue;
78892
+ while (p2.type !== "brace" && p2.type !== "root" && p2.parent) {
78893
+ p2 = p2.parent;
78894
+ q2 = p2.queue;
78895
78895
  }
78896
78896
  if (node.invalid || node.dollar) {
78897
78897
  q2.push(append(q2.pop(), stringify(node, options)));
@@ -79333,7 +79333,7 @@ var require_micromatch = __commonJS((exports, module) => {
79333
79333
  throw new Error(`No matches found for "${patterns.join(", ")}"`);
79334
79334
  }
79335
79335
  if (options.nonull === true || options.nullglob === true) {
79336
- return options.unescape ? patterns.map((p3) => p3.replace(/\\/g, "")) : patterns;
79336
+ return options.unescape ? patterns.map((p2) => p2.replace(/\\/g, "")) : patterns;
79337
79337
  }
79338
79338
  }
79339
79339
  return matches;
@@ -79364,7 +79364,7 @@ var require_micromatch = __commonJS((exports, module) => {
79364
79364
  throw new TypeError(`Expected a string: "${util.inspect(str2)}"`);
79365
79365
  }
79366
79366
  if (Array.isArray(pattern)) {
79367
- return pattern.some((p3) => micromatch.contains(str2, p3, options));
79367
+ return pattern.some((p2) => micromatch.contains(str2, p2, options));
79368
79368
  }
79369
79369
  if (typeof pattern === "string") {
79370
79370
  if (isEmptyString(str2) || isEmptyString(pattern)) {
@@ -79410,7 +79410,7 @@ var require_micromatch = __commonJS((exports, module) => {
79410
79410
  if (typeof str2 !== "string") {
79411
79411
  throw new TypeError(`Expected a string: "${util.inspect(str2)}"`);
79412
79412
  }
79413
- return [].concat(patterns).every((p3) => picomatch(p3, options)(str2));
79413
+ return [].concat(patterns).every((p2) => picomatch(p2, options)(str2));
79414
79414
  };
79415
79415
  micromatch.capture = (glob, input, options) => {
79416
79416
  let posix2 = utils28.isWindows(options);
@@ -80582,7 +80582,7 @@ var require_queue = __commonJS((exports, module) => {
80582
80582
  queue3.drained = drained;
80583
80583
  return queue3;
80584
80584
  function push3(value) {
80585
- var p3 = new Promise(function(resolve3, reject) {
80585
+ var p2 = new Promise(function(resolve3, reject) {
80586
80586
  pushCb(value, function(err2, result) {
80587
80587
  if (err2) {
80588
80588
  reject(err2);
@@ -80591,11 +80591,11 @@ var require_queue = __commonJS((exports, module) => {
80591
80591
  resolve3(result);
80592
80592
  });
80593
80593
  });
80594
- p3.catch(noop2);
80595
- return p3;
80594
+ p2.catch(noop2);
80595
+ return p2;
80596
80596
  }
80597
80597
  function unshift(value) {
80598
- var p3 = new Promise(function(resolve3, reject) {
80598
+ var p2 = new Promise(function(resolve3, reject) {
80599
80599
  unshiftCb(value, function(err2, result) {
80600
80600
  if (err2) {
80601
80601
  reject(err2);
@@ -80604,8 +80604,8 @@ var require_queue = __commonJS((exports, module) => {
80604
80604
  resolve3(result);
80605
80605
  });
80606
80606
  });
80607
- p3.catch(noop2);
80608
- return p3;
80607
+ p2.catch(noop2);
80608
+ return p2;
80609
80609
  }
80610
80610
  function drained() {
80611
80611
  if (queue3.idle()) {
@@ -80614,13 +80614,13 @@ var require_queue = __commonJS((exports, module) => {
80614
80614
  });
80615
80615
  }
80616
80616
  var previousDrain = queue3.drain;
80617
- var p3 = new Promise(function(resolve3) {
80617
+ var p2 = new Promise(function(resolve3) {
80618
80618
  queue3.drain = function() {
80619
80619
  previousDrain();
80620
80620
  resolve3();
80621
80621
  };
80622
80622
  });
80623
- return p3;
80623
+ return p2;
80624
80624
  }
80625
80625
  };
80626
80626
  var reusify = require_reusify();
@@ -86349,7 +86349,7 @@ var require_date = __commonJS((exports, module) => {
86349
86349
  this.fire();
86350
86350
  }
86351
86351
  reset() {
86352
- this.moveCursor(this.parts.findIndex((p3) => p3 instanceof DatePart));
86352
+ this.moveCursor(this.parts.findIndex((p2) => p2 instanceof DatePart));
86353
86353
  this.fire();
86354
86354
  this.render();
86355
86355
  }
@@ -86437,7 +86437,7 @@ var require_date = __commonJS((exports, module) => {
86437
86437
  else
86438
86438
  this.out.write(clear(this.outputText, this.out.columns));
86439
86439
  super.render();
86440
- this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.parts.reduce((arr2, p3, idx) => arr2.concat(idx === this.cursor && !this.done ? color.cyan().underline(p3.toString()) : p3), []).join("")].join(" ");
86440
+ this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.parts.reduce((arr2, p2, idx) => arr2.concat(idx === this.cursor && !this.done ? color.cyan().underline(p2.toString()) : p2), []).join("")].join(" ");
86441
86441
  if (this.error) {
86442
86442
  this.outputText += this.errorMsg.split("\n").reduce((a, l2, i) => a + `\n${i ? ` ` : figures.pointerSmall} ${color.red().italic(l2)}`, ``);
86443
86443
  }
@@ -86992,9 +86992,9 @@ var require_autocomplete = __commonJS((exports, module) => {
86992
86992
  complete(cb) {
86993
86993
  var _this = this;
86994
86994
  return _asyncToGenerator(function* () {
86995
- const p3 = _this.completing = _this.suggest(_this.input, _this.choices);
86996
- const suggestions = yield p3;
86997
- if (_this.completing !== p3)
86995
+ const p2 = _this.completing = _this.suggest(_this.input, _this.choices);
86996
+ const suggestions = yield p2;
86997
+ if (_this.completing !== p2)
86998
86998
  return;
86999
86999
  _this.suggestions = suggestions.map((s3, i, arr2) => ({
87000
87000
  title: getTitle(arr2, i),
@@ -87410,14 +87410,14 @@ var require_elements = __commonJS((exports, module) => {
87410
87410
  var require_prompts = __commonJS((exports) => {
87411
87411
  var toPrompt = function(type2, args, opts = {}) {
87412
87412
  return new Promise((res, rej) => {
87413
- const p3 = new el[type2](args);
87413
+ const p2 = new el[type2](args);
87414
87414
  const onAbort = opts.onAbort || noop2;
87415
87415
  const onSubmit = opts.onSubmit || noop2;
87416
87416
  const onExit = opts.onExit || noop2;
87417
- p3.on("state", args.onState || noop2);
87418
- p3.on("submit", (x) => res(onSubmit(x)));
87419
- p3.on("exit", (x) => res(onExit(x)));
87420
- p3.on("abort", (x) => rej(onAbort(x)));
87417
+ p2.on("state", args.onState || noop2);
87418
+ p2.on("submit", (x) => res(onSubmit(x)));
87419
+ p2.on("exit", (x) => res(onExit(x)));
87420
+ p2.on("abort", (x) => rej(onAbort(x)));
87421
87421
  });
87422
87422
  };
87423
87423
  var $2 = exports;
@@ -88721,7 +88721,7 @@ var require_date2 = __commonJS((exports, module) => {
88721
88721
  this.fire();
88722
88722
  }
88723
88723
  reset() {
88724
- this.moveCursor(this.parts.findIndex((p3) => p3 instanceof DatePart));
88724
+ this.moveCursor(this.parts.findIndex((p2) => p2 instanceof DatePart));
88725
88725
  this.fire();
88726
88726
  this.render();
88727
88727
  }
@@ -88807,7 +88807,7 @@ var require_date2 = __commonJS((exports, module) => {
88807
88807
  style.symbol(this.done, this.aborted),
88808
88808
  color.bold(this.msg),
88809
88809
  style.delimiter(false),
88810
- this.parts.reduce((arr2, p3, idx) => arr2.concat(idx === this.cursor && !this.done ? color.cyan().underline(p3.toString()) : p3), []).join("")
88810
+ this.parts.reduce((arr2, p2, idx) => arr2.concat(idx === this.cursor && !this.done ? color.cyan().underline(p2.toString()) : p2), []).join("")
88811
88811
  ].join(" ");
88812
88812
  if (this.error) {
88813
88813
  this.outputText += this.errorMsg.split("\n").reduce((a, l2, i) => a + `\n${i ? ` ` : figures.pointerSmall} ${color.red().italic(l2)}`, ``);
@@ -89276,9 +89276,9 @@ var require_autocomplete2 = __commonJS((exports, module) => {
89276
89276
  this.fire();
89277
89277
  }
89278
89278
  async complete(cb) {
89279
- const p3 = this.completing = this.suggest(this.input, this.choices);
89280
- const suggestions = await p3;
89281
- if (this.completing !== p3)
89279
+ const p2 = this.completing = this.suggest(this.input, this.choices);
89280
+ const suggestions = await p2;
89281
+ if (this.completing !== p2)
89282
89282
  return;
89283
89283
  this.suggestions = suggestions.map((s3, i, arr2) => ({ title: getTitle(arr2, i), value: getVal(arr2, i), description: s3.description }));
89284
89284
  this.completing = false;
@@ -89693,14 +89693,14 @@ var require_elements2 = __commonJS((exports, module) => {
89693
89693
  var require_prompts2 = __commonJS((exports) => {
89694
89694
  var toPrompt = function(type2, args, opts = {}) {
89695
89695
  return new Promise((res, rej) => {
89696
- const p3 = new el[type2](args);
89696
+ const p2 = new el[type2](args);
89697
89697
  const onAbort = opts.onAbort || noop2;
89698
89698
  const onSubmit = opts.onSubmit || noop2;
89699
89699
  const onExit = opts.onExit || noop2;
89700
- p3.on("state", args.onState || noop2);
89701
- p3.on("submit", (x) => res(onSubmit(x)));
89702
- p3.on("exit", (x) => res(onExit(x)));
89703
- p3.on("abort", (x) => rej(onAbort(x)));
89700
+ p2.on("state", args.onState || noop2);
89701
+ p2.on("submit", (x) => res(onSubmit(x)));
89702
+ p2.on("exit", (x) => res(onExit(x)));
89703
+ p2.on("abort", (x) => rej(onAbort(x)));
89704
89704
  });
89705
89705
  };
89706
89706
  var $2 = exports;
@@ -111730,179 +111730,6 @@ var safeLoadAll = renamed("safeLoadAll", "loadAll");
111730
111730
  var safeDump = renamed("safeDump", "dump");
111731
111731
  // ../utils/src/macroable.ts
111732
111732
  var import_macroable = __toESM(require_build(), 1);
111733
- // ../../../../node_modules/yocto-queue/index.js
111734
- class Node3 {
111735
- value;
111736
- next;
111737
- constructor(value) {
111738
- this.value = value;
111739
- }
111740
- }
111741
-
111742
- class Queue {
111743
- #head;
111744
- #tail;
111745
- #size;
111746
- constructor() {
111747
- this.clear();
111748
- }
111749
- enqueue(value) {
111750
- const node = new Node3(value);
111751
- if (this.#head) {
111752
- this.#tail.next = node;
111753
- this.#tail = node;
111754
- } else {
111755
- this.#head = node;
111756
- this.#tail = node;
111757
- }
111758
- this.#size++;
111759
- }
111760
- dequeue() {
111761
- const current2 = this.#head;
111762
- if (!current2) {
111763
- return;
111764
- }
111765
- this.#head = this.#head.next;
111766
- this.#size--;
111767
- return current2.value;
111768
- }
111769
- clear() {
111770
- this.#head = undefined;
111771
- this.#tail = undefined;
111772
- this.#size = 0;
111773
- }
111774
- get size() {
111775
- return this.#size;
111776
- }
111777
- *[Symbol.iterator]() {
111778
- let current2 = this.#head;
111779
- while (current2) {
111780
- yield current2.value;
111781
- current2 = current2.next;
111782
- }
111783
- }
111784
- }
111785
-
111786
- // ../../../../node_modules/p-limit/index.js
111787
- import {AsyncResource} from "lib/index.j";
111788
- function pLimit(concurrency) {
111789
- if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
111790
- throw new TypeError("Expected `concurrency` to be a number from 1 and up");
111791
- }
111792
- const queue3 = new Queue;
111793
- let activeCount = 0;
111794
- const next = () => {
111795
- activeCount--;
111796
- if (queue3.size > 0) {
111797
- queue3.dequeue()();
111798
- }
111799
- };
111800
- const run = async (function_, resolve3, arguments_) => {
111801
- activeCount++;
111802
- const result = (async () => function_(...arguments_))();
111803
- resolve3(result);
111804
- try {
111805
- await result;
111806
- } catch {
111807
- }
111808
- next();
111809
- };
111810
- const enqueue = (function_, resolve3, arguments_) => {
111811
- queue3.enqueue(AsyncResource.bind(run.bind(undefined, function_, resolve3, arguments_)));
111812
- (async () => {
111813
- await Promise.resolve();
111814
- if (activeCount < concurrency && queue3.size > 0) {
111815
- queue3.dequeue()();
111816
- }
111817
- })();
111818
- };
111819
- const generator = (function_, ...arguments_) => new Promise((resolve3) => {
111820
- enqueue(function_, resolve3, arguments_);
111821
- });
111822
- Object.defineProperties(generator, {
111823
- activeCount: {
111824
- get: () => activeCount
111825
- },
111826
- pendingCount: {
111827
- get: () => queue3.size
111828
- },
111829
- clearQueue: {
111830
- value() {
111831
- queue3.clear();
111832
- }
111833
- }
111834
- });
111835
- return generator;
111836
- }
111837
-
111838
- // ../utils/src/p.ts
111839
- var VOID = Symbol("p-void");
111840
-
111841
- class PInstance extends Promise {
111842
- items;
111843
- options;
111844
- promises = new Set;
111845
- get promise() {
111846
- let batch;
111847
- const items = [...Array.from(this.items), ...Array.from(this.promises)];
111848
- if (this.options?.concurrency) {
111849
- const limit = pLimit(this.options.concurrency);
111850
- batch = Promise.all(items.map((p2) => limit(() => p2)));
111851
- } else {
111852
- batch = Promise.all(items);
111853
- }
111854
- return batch.then((l2) => l2.filter((i) => i !== VOID));
111855
- }
111856
- constructor(items = [], options) {
111857
- super(() => {
111858
- });
111859
- this.items = items;
111860
- this.options = options;
111861
- }
111862
- add(...args) {
111863
- args.forEach((i) => {
111864
- this.promises.add(i);
111865
- });
111866
- }
111867
- map(fn) {
111868
- return new PInstance(Array.from(this.items).map(async (i, idx) => {
111869
- const v2 = await i;
111870
- if (v2 === VOID)
111871
- return VOID;
111872
- return fn(v2, idx);
111873
- }), this.options);
111874
- }
111875
- filter(fn) {
111876
- return new PInstance(Array.from(this.items).map(async (i, idx) => {
111877
- const v2 = await i;
111878
- const r2 = await fn(v2, idx);
111879
- if (!r2)
111880
- return VOID;
111881
- return v2;
111882
- }), this.options);
111883
- }
111884
- forEach(fn) {
111885
- return this.map(fn).then();
111886
- }
111887
- reduce(fn, initialValue) {
111888
- return this.promise.then((array) => array.reduce(fn, initialValue));
111889
- }
111890
- clear() {
111891
- this.promises.clear();
111892
- }
111893
- then(fn) {
111894
- const p2 = this.promise;
111895
- if (fn)
111896
- return p2.then(fn);
111897
- return p2;
111898
- }
111899
- catch(fn) {
111900
- return this.promise.catch(fn);
111901
- }
111902
- finally(fn) {
111903
- return this.promise.finally(fn);
111904
- }
111905
- }
111906
111733
  // ../storage/src/fs.ts
111907
111734
  var fs2 = __toESM(require_lib(), 1);
111908
111735
  // ../storage/src/helpers.ts
@@ -111932,8 +111759,10 @@ class ErrorHandler {
111932
111759
  }
111933
111760
  static async writeErrorToFile(err2) {
111934
111761
  const formattedError = `[${new Date().toISOString()}] ${err2.name}: ${err2.message}\n`;
111762
+ const errorsLogFilePath = logsPath("errors.log");
111935
111763
  try {
111936
- await fs2.appendFile(logFilePath, formattedError);
111764
+ await fs2.mkdir(dirname2(errorsLogFilePath), { recursive: true });
111765
+ await fs2.appendFile(errorsLogFilePath, formattedError);
111937
111766
  } catch (error) {
111938
111767
  console.error("Failed to write to error file:", error);
111939
111768
  }
@@ -112027,7 +111856,7 @@ var __asyncGenerator = function(thisArg, _arguments, generator) {
112027
111856
  }
112028
111857
  };
112029
111858
  var __asyncDelegator = function(o) {
112030
- var i, p3;
111859
+ var i, p2;
112031
111860
  return i = {}, verb("next"), verb("throw", function(e) {
112032
111861
  throw e;
112033
111862
  }), verb("return"), i[Symbol.iterator] = function() {
@@ -112035,7 +111864,7 @@ var __asyncDelegator = function(o) {
112035
111864
  }, i;
112036
111865
  function verb(n, f2) {
112037
111866
  i[n] = o[n] ? function(v2) {
112038
- return (p3 = !p3) ? { value: __await(o[n](v2)), done: n === "return" } : f2 ? f2(v2) : v2;
111867
+ return (p2 = !p2) ? { value: __await(o[n](v2)), done: n === "return" } : f2 ? f2(v2) : v2;
112039
111868
  } : f2;
112040
111869
  }
112041
111870
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/router",
3
3
  "type": "module",
4
- "version": "0.59.8",
4
+ "version": "0.59.10",
5
5
  "description": "The Stacks framework router.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",