@h3ravel/shared 0.25.0 → 0.26.1
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.cjs +10 -41
- package/dist/index.d.ts +741 -69
- package/dist/index.js +11 -39
- package/package.json +3 -3
- package/dist/index.d.cts +0 -776
package/dist/index.cjs
CHANGED
|
@@ -22,7 +22,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
|
|
23
23
|
//#endregion
|
|
24
24
|
let fs_promises = require("fs/promises");
|
|
25
|
-
fs_promises = __toESM(fs_promises);
|
|
26
25
|
let escalade_sync = require("escalade/sync");
|
|
27
26
|
escalade_sync = __toESM(escalade_sync);
|
|
28
27
|
let path = require("path");
|
|
@@ -32,50 +31,11 @@ chalk = __toESM(chalk);
|
|
|
32
31
|
let inquirer_autocomplete_standalone = require("inquirer-autocomplete-standalone");
|
|
33
32
|
inquirer_autocomplete_standalone = __toESM(inquirer_autocomplete_standalone);
|
|
34
33
|
let __inquirer_prompts = require("@inquirer/prompts");
|
|
35
|
-
__inquirer_prompts = __toESM(__inquirer_prompts);
|
|
36
34
|
let crypto = require("crypto");
|
|
37
35
|
crypto = __toESM(crypto);
|
|
38
36
|
let preferred_pm = require("preferred-pm");
|
|
39
37
|
preferred_pm = __toESM(preferred_pm);
|
|
40
38
|
|
|
41
|
-
//#region src/Contracts/IHttp.ts
|
|
42
|
-
/**
|
|
43
|
-
* Represents the HTTP context for a single request lifecycle.
|
|
44
|
-
* Encapsulates the application instance, request, and response objects.
|
|
45
|
-
*/
|
|
46
|
-
var HttpContext = class HttpContext {
|
|
47
|
-
static contexts = /* @__PURE__ */ new WeakMap();
|
|
48
|
-
constructor(app, request, response) {
|
|
49
|
-
this.app = app;
|
|
50
|
-
this.request = request;
|
|
51
|
-
this.response = response;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Factory method to create a new HttpContext instance from a context object.
|
|
55
|
-
* @param ctx - Object containing app, request, and response
|
|
56
|
-
* @returns A new HttpContext instance
|
|
57
|
-
*/
|
|
58
|
-
static init(ctx, event) {
|
|
59
|
-
if (event && HttpContext.contexts.has(event)) return HttpContext.contexts.get(event);
|
|
60
|
-
const instance = new HttpContext(ctx.app, ctx.request, ctx.response);
|
|
61
|
-
if (event) HttpContext.contexts.set(event, instance);
|
|
62
|
-
return instance;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Retrieve an existing HttpContext instance for an event, if any.
|
|
66
|
-
*/
|
|
67
|
-
static get(event) {
|
|
68
|
-
return HttpContext.contexts.get(event);
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Delete the cached context for a given event (optional cleanup).
|
|
72
|
-
*/
|
|
73
|
-
static forget(event) {
|
|
74
|
-
HttpContext.contexts.delete(event);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
//#endregion
|
|
79
39
|
//#region src/Utils/EnvParser.ts
|
|
80
40
|
var EnvParser = class {
|
|
81
41
|
static parse(initial) {
|
|
@@ -466,6 +426,16 @@ var Resolver = class {
|
|
|
466
426
|
static hashObjectOrFunction(provider) {
|
|
467
427
|
return crypto.default.createHash("sha1").update(provider.toString()).digest("hex");
|
|
468
428
|
}
|
|
429
|
+
/**
|
|
430
|
+
* Checks if a function is asyncronous
|
|
431
|
+
*
|
|
432
|
+
* @param func
|
|
433
|
+
* @returns
|
|
434
|
+
*/
|
|
435
|
+
static isAsyncFunction(func) {
|
|
436
|
+
if (typeof func !== "function") return false;
|
|
437
|
+
return Object.prototype.toString.call(func) === "[object AsyncFunction]";
|
|
438
|
+
}
|
|
469
439
|
};
|
|
470
440
|
|
|
471
441
|
//#endregion
|
|
@@ -557,7 +527,6 @@ var TaskManager = class {
|
|
|
557
527
|
//#endregion
|
|
558
528
|
exports.EnvParser = EnvParser;
|
|
559
529
|
exports.FileSystem = FileSystem;
|
|
560
|
-
exports.HttpContext = HttpContext;
|
|
561
530
|
exports.Logger = Logger;
|
|
562
531
|
exports.PathLoader = PathLoader;
|
|
563
532
|
exports.Prompts = Prompts;
|