@cldmv/slothlet 2.11.0 → 3.0.0
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/AGENT-USAGE.md +355 -325
- package/README.md +554 -238
- package/dist/lib/builders/api-assignment.mjs +605 -0
- package/dist/lib/builders/api_builder.mjs +1073 -0
- package/dist/lib/builders/builder.mjs +94 -0
- package/dist/lib/builders/modes-processor.mjs +1816 -0
- package/dist/lib/errors.mjs +227 -0
- package/dist/lib/factories/component-base.mjs +96 -0
- package/dist/lib/factories/context.mjs +38 -0
- package/dist/lib/handlers/api-cache-manager.mjs +216 -0
- package/dist/lib/handlers/api-manager.mjs +2364 -0
- package/dist/lib/handlers/context-async.mjs +184 -0
- package/dist/lib/handlers/context-live.mjs +184 -0
- package/dist/lib/handlers/hook-manager.mjs +789 -0
- package/dist/lib/handlers/lifecycle-token.mjs +44 -0
- package/dist/lib/handlers/lifecycle.mjs +131 -0
- package/dist/lib/handlers/materialize-manager.mjs +64 -0
- package/dist/lib/handlers/metadata.mjs +500 -0
- package/dist/lib/handlers/ownership.mjs +338 -0
- package/dist/lib/handlers/unified-wrapper.mjs +3031 -0
- package/dist/lib/helpers/class-instance-wrapper.mjs +125 -0
- package/dist/lib/helpers/config.mjs +343 -0
- package/dist/lib/helpers/eventemitter-context.mjs +365 -0
- package/dist/lib/helpers/hint-detector.mjs +63 -0
- package/dist/lib/helpers/modes-utils.mjs +53 -0
- package/dist/lib/helpers/resolve-from-caller.mjs +119 -116
- package/dist/lib/helpers/sanitize.mjs +247 -168
- package/dist/lib/helpers/utilities.mjs +46 -81
- package/dist/lib/i18n/languages/de-de.json +377 -0
- package/dist/lib/i18n/languages/en-gb.json +377 -0
- package/dist/lib/i18n/languages/en-us.json +377 -0
- package/dist/lib/i18n/languages/es-mx.json +377 -0
- package/dist/lib/i18n/languages/fr-fr.json +377 -0
- package/dist/lib/i18n/languages/hi-in.json +377 -0
- package/dist/lib/i18n/languages/ja-jp.json +377 -0
- package/dist/lib/i18n/languages/ko-kr.json +377 -0
- package/dist/lib/i18n/languages/pt-br.json +377 -0
- package/dist/lib/i18n/languages/ru-ru.json +377 -0
- package/dist/lib/i18n/languages/zh-cn.json +377 -0
- package/dist/lib/i18n/translations.mjs +140 -0
- package/dist/lib/modes/eager.mjs +75 -0
- package/dist/lib/modes/lazy.mjs +97 -0
- package/dist/lib/processors/flatten.mjs +453 -0
- package/dist/lib/processors/loader.mjs +355 -0
- package/dist/lib/processors/type-generator.mjs +291 -0
- package/dist/lib/processors/typescript.mjs +188 -0
- package/dist/lib/runtime/runtime-asynclocalstorage.mjs +80 -522
- package/dist/lib/runtime/runtime-livebindings.mjs +45 -390
- package/dist/lib/runtime/runtime.mjs +39 -159
- package/dist/slothlet.mjs +525 -744
- package/docs/API-RULES.md +338 -486
- package/index.cjs +4 -4
- package/index.mjs +82 -45
- package/package.json +138 -25
- package/types/dist/lib/builders/api-assignment.d.mts +97 -0
- package/types/dist/lib/builders/api-assignment.d.mts.map +1 -0
- package/types/dist/lib/builders/api_builder.d.mts +96 -0
- package/types/dist/lib/builders/api_builder.d.mts.map +1 -0
- package/types/dist/lib/builders/builder.d.mts +60 -0
- package/types/dist/lib/builders/builder.d.mts.map +1 -0
- package/types/dist/lib/builders/modes-processor.d.mts +32 -0
- package/types/dist/lib/builders/modes-processor.d.mts.map +1 -0
- package/types/dist/lib/errors.d.mts +118 -0
- package/types/dist/lib/errors.d.mts.map +1 -0
- package/types/dist/lib/factories/component-base.d.mts +182 -0
- package/types/dist/lib/factories/component-base.d.mts.map +1 -0
- package/types/dist/lib/factories/context.d.mts +26 -0
- package/types/dist/lib/factories/context.d.mts.map +1 -0
- package/types/dist/lib/handlers/api-cache-manager.d.mts +208 -0
- package/types/dist/lib/handlers/api-cache-manager.d.mts.map +1 -0
- package/types/dist/lib/handlers/api-manager.d.mts +392 -0
- package/types/dist/lib/handlers/api-manager.d.mts.map +1 -0
- package/types/dist/lib/handlers/context-async.d.mts +66 -0
- package/types/dist/lib/handlers/context-async.d.mts.map +1 -0
- package/types/dist/lib/handlers/context-live.d.mts +65 -0
- package/types/dist/lib/handlers/context-live.d.mts.map +1 -0
- package/types/dist/lib/handlers/hook-manager.d.mts +199 -0
- package/types/dist/lib/handlers/hook-manager.d.mts.map +1 -0
- package/types/dist/lib/handlers/lifecycle-token.d.mts +49 -0
- package/types/dist/lib/handlers/lifecycle-token.d.mts.map +1 -0
- package/types/dist/lib/handlers/lifecycle.d.mts +90 -0
- package/types/dist/lib/handlers/lifecycle.d.mts.map +1 -0
- package/types/dist/lib/handlers/materialize-manager.d.mts +75 -0
- package/types/dist/lib/handlers/materialize-manager.d.mts.map +1 -0
- package/types/dist/lib/handlers/metadata.d.mts +215 -0
- package/types/dist/lib/handlers/metadata.d.mts.map +1 -0
- package/types/dist/lib/handlers/ownership.d.mts +170 -0
- package/types/dist/lib/handlers/ownership.d.mts.map +1 -0
- package/types/dist/lib/handlers/unified-wrapper.d.mts +250 -0
- package/types/dist/lib/handlers/unified-wrapper.d.mts.map +1 -0
- package/types/dist/lib/helpers/class-instance-wrapper.d.mts +54 -0
- package/types/dist/lib/helpers/class-instance-wrapper.d.mts.map +1 -0
- package/types/dist/lib/helpers/config.d.mts +96 -0
- package/types/dist/lib/helpers/config.d.mts.map +1 -0
- package/types/dist/lib/helpers/eventemitter-context.d.mts +31 -0
- package/types/dist/lib/helpers/eventemitter-context.d.mts.map +1 -0
- package/types/dist/lib/helpers/hint-detector.d.mts +20 -0
- package/types/dist/lib/helpers/hint-detector.d.mts.map +1 -0
- package/types/dist/lib/helpers/modes-utils.d.mts +35 -0
- package/types/dist/lib/helpers/modes-utils.d.mts.map +1 -0
- package/types/dist/lib/helpers/resolve-from-caller.d.mts +29 -145
- package/types/dist/lib/helpers/resolve-from-caller.d.mts.map +1 -1
- package/types/dist/lib/helpers/sanitize.d.mts +95 -94
- package/types/dist/lib/helpers/sanitize.d.mts.map +1 -1
- package/types/dist/lib/helpers/utilities.d.mts +53 -116
- package/types/dist/lib/helpers/utilities.d.mts.map +1 -1
- package/types/dist/lib/i18n/translations.d.mts +39 -0
- package/types/dist/lib/i18n/translations.d.mts.map +1 -0
- package/types/dist/lib/modes/eager.d.mts +36 -0
- package/types/dist/lib/modes/eager.d.mts.map +1 -0
- package/types/dist/lib/modes/lazy.d.mts +49 -0
- package/types/dist/lib/modes/lazy.d.mts.map +1 -0
- package/types/dist/lib/processors/flatten.d.mts +114 -0
- package/types/dist/lib/processors/flatten.d.mts.map +1 -0
- package/types/dist/lib/processors/loader.d.mts +47 -0
- package/types/dist/lib/processors/loader.d.mts.map +1 -0
- package/types/dist/lib/processors/type-generator.d.mts +19 -0
- package/types/dist/lib/processors/type-generator.d.mts.map +1 -0
- package/types/dist/lib/processors/typescript.d.mts +55 -0
- package/types/dist/lib/processors/typescript.d.mts.map +1 -0
- package/types/dist/lib/runtime/runtime-asynclocalstorage.d.mts +47 -42
- package/types/dist/lib/runtime/runtime-asynclocalstorage.d.mts.map +1 -1
- package/types/dist/lib/runtime/runtime-livebindings.d.mts +34 -65
- package/types/dist/lib/runtime/runtime-livebindings.d.mts.map +1 -1
- package/types/dist/lib/runtime/runtime.d.mts +39 -9
- package/types/dist/lib/runtime/runtime.d.mts.map +1 -1
- package/types/dist/slothlet.d.mts +184 -111
- package/types/dist/slothlet.d.mts.map +1 -1
- package/types/index.d.mts +1 -3
- package/dist/lib/engine/README.md +0 -21
- package/dist/lib/engine/slothlet_child.mjs +0 -59
- package/dist/lib/engine/slothlet_engine.mjs +0 -372
- package/dist/lib/engine/slothlet_esm.mjs +0 -230
- package/dist/lib/engine/slothlet_helpers.mjs +0 -455
- package/dist/lib/engine/slothlet_worker.mjs +0 -149
- package/dist/lib/helpers/als-eventemitter.mjs +0 -256
- package/dist/lib/helpers/api_builder/add_api.mjs +0 -553
- package/dist/lib/helpers/api_builder/analysis.mjs +0 -532
- package/dist/lib/helpers/api_builder/construction.mjs +0 -495
- package/dist/lib/helpers/api_builder/decisions.mjs +0 -748
- package/dist/lib/helpers/api_builder/metadata.mjs +0 -248
- package/dist/lib/helpers/api_builder.mjs +0 -41
- package/dist/lib/helpers/auto-wrap.mjs +0 -62
- package/dist/lib/helpers/hooks.mjs +0 -389
- package/dist/lib/helpers/instance-manager.mjs +0 -111
- package/dist/lib/helpers/metadata-api.mjs +0 -201
- package/dist/lib/helpers/multidefault.mjs +0 -216
- package/dist/lib/modes/slothlet_eager.mjs +0 -154
- package/dist/lib/modes/slothlet_lazy.mjs +0 -594
- package/docs/API-RULES-CONDITIONS.md +0 -712
- package/types/dist/lib/engine/slothlet_child.d.mts +0 -2
- package/types/dist/lib/engine/slothlet_child.d.mts.map +0 -1
- package/types/dist/lib/engine/slothlet_engine.d.mts +0 -31
- package/types/dist/lib/engine/slothlet_engine.d.mts.map +0 -1
- package/types/dist/lib/engine/slothlet_esm.d.mts +0 -19
- package/types/dist/lib/engine/slothlet_esm.d.mts.map +0 -1
- package/types/dist/lib/engine/slothlet_helpers.d.mts +0 -25
- package/types/dist/lib/engine/slothlet_helpers.d.mts.map +0 -1
- package/types/dist/lib/engine/slothlet_worker.d.mts +0 -2
- package/types/dist/lib/engine/slothlet_worker.d.mts.map +0 -1
- package/types/dist/lib/helpers/als-eventemitter.d.mts +0 -56
- package/types/dist/lib/helpers/als-eventemitter.d.mts.map +0 -1
- package/types/dist/lib/helpers/api_builder/add_api.d.mts +0 -102
- package/types/dist/lib/helpers/api_builder/add_api.d.mts.map +0 -1
- package/types/dist/lib/helpers/api_builder/analysis.d.mts +0 -189
- package/types/dist/lib/helpers/api_builder/analysis.d.mts.map +0 -1
- package/types/dist/lib/helpers/api_builder/construction.d.mts +0 -107
- package/types/dist/lib/helpers/api_builder/construction.d.mts.map +0 -1
- package/types/dist/lib/helpers/api_builder/decisions.d.mts +0 -213
- package/types/dist/lib/helpers/api_builder/decisions.d.mts.map +0 -1
- package/types/dist/lib/helpers/api_builder/metadata.d.mts +0 -99
- package/types/dist/lib/helpers/api_builder/metadata.d.mts.map +0 -1
- package/types/dist/lib/helpers/api_builder.d.mts +0 -6
- package/types/dist/lib/helpers/api_builder.d.mts.map +0 -1
- package/types/dist/lib/helpers/auto-wrap.d.mts +0 -49
- package/types/dist/lib/helpers/auto-wrap.d.mts.map +0 -1
- package/types/dist/lib/helpers/hooks.d.mts +0 -342
- package/types/dist/lib/helpers/hooks.d.mts.map +0 -1
- package/types/dist/lib/helpers/instance-manager.d.mts +0 -41
- package/types/dist/lib/helpers/instance-manager.d.mts.map +0 -1
- package/types/dist/lib/helpers/metadata-api.d.mts +0 -132
- package/types/dist/lib/helpers/metadata-api.d.mts.map +0 -1
- package/types/dist/lib/helpers/multidefault.d.mts +0 -90
- package/types/dist/lib/helpers/multidefault.d.mts.map +0 -1
- package/types/dist/lib/modes/slothlet_eager.d.mts +0 -65
- package/types/dist/lib/modes/slothlet_eager.d.mts.map +0 -1
- package/types/dist/lib/modes/slothlet_lazy.d.mts +0 -31
- package/types/dist/lib/modes/slothlet_lazy.d.mts.map +0 -1
- package/types/index.d.mts.map +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mode processing utilities component class
|
|
3
|
+
* @extends ComponentBase
|
|
4
|
+
*/
|
|
5
|
+
export class ModesUtils extends ComponentBase {
|
|
6
|
+
static slothletProperty: string;
|
|
7
|
+
/**
|
|
8
|
+
* Create a named wrapper for default export functions when they are anonymous.
|
|
9
|
+
* NOTE: This function is now a pass-through since UnifiedWrapper handles name/length/toString
|
|
10
|
+
* through its proxy get trap. Wrapping is no longer needed and causes toString mismatches.
|
|
11
|
+
* @param {Function} fn - Original function.
|
|
12
|
+
* @param {string} nameHint - Name to apply if fn is anonymous or named "default" (unused).
|
|
13
|
+
* @returns {Function} Original function unmodified.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
public ensureNamedExportFunction(fn: Function, ____nameHint: any): Function;
|
|
17
|
+
/**
|
|
18
|
+
* Clone eager-mode module exports to avoid mutating import cache objects.
|
|
19
|
+
* @param {unknown} value - Value to clone for wrapping
|
|
20
|
+
* @param {string} mode - Current mode ("eager" or "lazy")
|
|
21
|
+
* @returns {unknown} Cloned value for eager mode, original otherwise
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
public cloneWrapperImpl(value: unknown, mode: string): unknown;
|
|
25
|
+
/**
|
|
26
|
+
* Helper to determine collision mode for ownership conflicts
|
|
27
|
+
* @param {Object} config - Slothlet configuration
|
|
28
|
+
* @param {string} collisionContext - Either 'initial' or 'api'
|
|
29
|
+
* @returns {string} Collision mode from config
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
public getOwnershipCollisionMode(config: any, collisionContext?: string): string;
|
|
33
|
+
}
|
|
34
|
+
import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
|
|
35
|
+
//# sourceMappingURL=modes-utils.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modes-utils.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/modes-utils.mjs"],"names":[],"mappings":"AAqBA;;;GAGG;AACH;IACC,gCAAuC;IAEvC;;;;;;;;OAQG;IACH,4EAIC;IAED;;;;;;OAMG;IACH,+BALW,OAAO,QACP,MAAM,GACJ,OAAO,CAenB;IAED;;;;;;OAMG;IACH,iEAJW,MAAM,GACJ,MAAM,CAKlB;CACD;8BAvD6B,0CAA0C"}
|
|
@@ -1,149 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Path resolver component
|
|
3
|
+
* @class Resolver
|
|
4
|
+
* @extends ComponentBase
|
|
3
5
|
* @package
|
|
4
|
-
* @internal
|
|
5
|
-
* @param {Function} [skipFn] - Function to skip in stack trace via Error.captureStackTrace
|
|
6
|
-
* @returns {Array<CallSite>} Array of V8 CallSite objects with methods like getFileName(), getLineNumber(), etc.
|
|
7
|
-
*
|
|
8
|
-
* @description
|
|
9
|
-
* Get V8 stack trace as CallSite array for debugging and caller detection.
|
|
10
|
-
* Temporarily overrides Error.prepareStackTrace to access raw V8 CallSite objects
|
|
11
|
-
* instead of formatted string stack traces. Provides safe restoration of original handler.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* // Get current call stack for debugging
|
|
15
|
-
* const stack = getStack();
|
|
16
|
-
* console.log(stack[0]?.getFileName?.()); // Current file path
|
|
17
|
-
* console.log(stack[0]?.getLineNumber?.()); // Current line number
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // Skip current function from stack trace
|
|
21
|
-
* function myFunction() {
|
|
22
|
-
* return getStack(myFunction); // Stack starts from caller of myFunction
|
|
23
|
-
* }
|
|
24
|
-
* const callerStack = myFunction();
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* // Stack analysis for caller detection
|
|
28
|
-
* function findCaller() {
|
|
29
|
-
* const stack = getStack(findCaller);
|
|
30
|
-
* for (const frame of stack) {
|
|
31
|
-
* const filename = frame?.getFileName?.();
|
|
32
|
-
* if (filename && !filename.includes("node_modules")) {
|
|
33
|
-
* return filename; // First non-dependency file
|
|
34
|
-
* }
|
|
35
|
-
* }
|
|
36
|
-
* }
|
|
37
6
|
*/
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
* const configPath = resolvePathFromCaller("../config.json");
|
|
65
|
-
* // Returns: /project/config.json (absolute filesystem path)
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* // Short-circuit cases
|
|
69
|
-
* resolvePathFromCaller("file:///absolute/path.txt");
|
|
70
|
-
* // Returns: /absolute/path.txt (converted from URL)
|
|
71
|
-
*
|
|
72
|
-
* resolvePathFromCaller("/already/absolute/path.txt");
|
|
73
|
-
* // Returns: /already/absolute/path.txt (unchanged)
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* // Relative resolution from different contexts
|
|
77
|
-
* // If called from /project/src/lib/utils.mjs:
|
|
78
|
-
* resolvePathFromCaller("./helpers/format.js");
|
|
79
|
-
* // Returns: /project/src/lib/helpers/format.js
|
|
80
|
-
*
|
|
81
|
-
* resolvePathFromCaller("../../config/settings.json");
|
|
82
|
-
* // Returns: /project/config/settings.json
|
|
83
|
-
*/
|
|
84
|
-
export function resolvePathFromCaller(rel: string): string;
|
|
85
|
-
/**
|
|
86
|
-
* @function resolveUrlFromCaller
|
|
87
|
-
* @package
|
|
88
|
-
* @internal
|
|
89
|
-
* @param {string} rel - Relative path to resolve (e.g., "../config.json", "./data/file.txt")
|
|
90
|
-
* @returns {string} Absolute file:// URL suitable for dynamic imports and URL operations
|
|
91
|
-
* @throws {TypeError} When rel parameter is not a string
|
|
92
|
-
*
|
|
93
|
-
* @description
|
|
94
|
-
* Resolve a relative path from the caller's context to a file:// URL.
|
|
95
|
-
* Companion API to resolvePathFromCaller that returns file:// URLs instead of filesystem paths.
|
|
96
|
-
* Uses identical caller detection algorithm but outputs URL format for ESM imports.
|
|
97
|
-
*
|
|
98
|
-
* Resolution behavior:
|
|
99
|
-
* - file:// URLs: Returned unchanged (already in URL format)
|
|
100
|
-
* - Absolute paths: Converted to file:// URLs via pathToFileURL()
|
|
101
|
-
* - Relative paths: Resolved using caller detection, then converted to URL
|
|
102
|
-
*
|
|
103
|
-
* Caller detection uses the same sophisticated algorithm as resolvePathFromCaller,
|
|
104
|
-
* but the final result is converted to a file:// URL for compatibility with
|
|
105
|
-
* ESM dynamic imports and other URL-based operations.
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* // From a file at /project/src/modules/math.mjs
|
|
109
|
-
* const configUrl = resolveUrlFromCaller("../config.json");
|
|
110
|
-
* // Returns: file:///project/config.json (absolute file:// URL)
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* // Short-circuit cases
|
|
114
|
-
* resolveUrlFromCaller("file:///absolute/path.txt");
|
|
115
|
-
* // Returns: file:///absolute/path.txt (unchanged)
|
|
116
|
-
*
|
|
117
|
-
* resolveUrlFromCaller("/already/absolute/path.txt");
|
|
118
|
-
* // Returns: file:///already/absolute/path.txt (converted to URL)
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* // Dynamic ESM import usage
|
|
122
|
-
* const modulePath = resolveUrlFromCaller("./dynamic-module.mjs");
|
|
123
|
-
* const dynamicModule = await import(modulePath);
|
|
124
|
-
* // Works seamlessly with ESM import() which expects URLs
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* // Cross-platform URL handling
|
|
128
|
-
* // Unix: resolveUrlFromCaller("../config.json") → file:///project/config.json
|
|
129
|
-
* // Windows: resolveUrlFromCaller("../config.json") → file:///C:/project/config.json
|
|
130
|
-
*/
|
|
131
|
-
export function resolveUrlFromCaller(rel: string): string;
|
|
132
|
-
export function toFsPath(v: any): string | null;
|
|
133
|
-
export type CallSite = {
|
|
134
|
-
getFileName: () => string | undefined;
|
|
135
|
-
getLineNumber: () => number | undefined;
|
|
136
|
-
getFunctionName: () => string | undefined;
|
|
137
|
-
getTypeName: () => string | undefined;
|
|
138
|
-
getMethodName: () => string | undefined;
|
|
139
|
-
getScriptNameOrSourceURL: () => string | undefined;
|
|
140
|
-
getColumnNumber: () => number | undefined;
|
|
141
|
-
isNative: () => boolean | undefined;
|
|
142
|
-
isEval: () => boolean | undefined;
|
|
143
|
-
isConstructor: () => boolean | undefined;
|
|
144
|
-
isToplevel: () => boolean | undefined;
|
|
145
|
-
isAsync: () => boolean | undefined;
|
|
146
|
-
isPromiseAll: () => boolean | undefined;
|
|
147
|
-
getPromiseIndex: () => number | undefined;
|
|
148
|
-
};
|
|
7
|
+
export class Resolver extends ComponentBase {
|
|
8
|
+
static slothletProperty: string;
|
|
9
|
+
/**
|
|
10
|
+
* Get V8 stack trace as CallSite array.
|
|
11
|
+
* @param {Function} [skipFn] - Optional function to skip from stack trace
|
|
12
|
+
* @returns {Array} Array of CallSite objects
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
public getStack(skipFn?: Function): any[];
|
|
16
|
+
/**
|
|
17
|
+
* Convert file:// URL to filesystem path or return as-is.
|
|
18
|
+
* @param {any} v - Value to convert
|
|
19
|
+
* @returns {string|null} Filesystem path or null
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
public toFsPath(v: any): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Resolve relative path from caller's context.
|
|
25
|
+
* @param {string} rel - Relative path to resolve
|
|
26
|
+
* @returns {string} Absolute filesystem path
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
public resolvePathFromCaller(rel: string): string;
|
|
30
|
+
#private;
|
|
31
|
+
}
|
|
32
|
+
import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
|
|
149
33
|
//# sourceMappingURL=resolve-from-caller.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-from-caller.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/resolve-from-caller.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-from-caller.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/resolve-from-caller.mjs"],"names":[],"mappings":"AAqCA;;;;;GAKG;AACH;IACC,gCAAqC;IAErC;;;;;OAKG;IACH,0CAUC;IAeD;;;;;OAKG;IACH,mBAJW,GAAG,GACD,MAAM,GAAC,IAAI,CAOvB;IA4FD;;;;;OAKG;IACH,kCAJW,MAAM,GACJ,MAAM,CAsClB;;CACD;8BApM6B,0CAA0C"}
|
|
@@ -1,97 +1,98 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @
|
|
4
|
-
* @
|
|
5
|
-
* @
|
|
6
|
-
* @
|
|
7
|
-
* @param {boolean} [opts.lowerFirst=true] - Lowercase the first character of the first segment for camelCase convention
|
|
8
|
-
* @param {boolean} [opts.preserveAllUpper=false] - Automatically preserve any identifier that is already in all-uppercase format
|
|
9
|
-
* @param {boolean} [opts.preserveAllLower=false] - Automatically preserve any identifier that is already in all-lowercase format
|
|
10
|
-
* @param {Object} [opts.rules={}] - Advanced segment transformation rules (supports glob patterns: *, ?, **STRING**)
|
|
11
|
-
* @param {string[]} [opts.rules.leave=[]] - Segments to preserve exactly as-is (case-sensitive, supports globs)
|
|
12
|
-
* @param {string[]} [opts.rules.leaveInsensitive=[]] - Segments to preserve exactly as-is (case-insensitive, supports globs)
|
|
13
|
-
* @param {string[]} [opts.rules.upper=[]] - Segments to force to UPPERCASE (supports globs and **STRING** boundary patterns)
|
|
14
|
-
* @param {string[]} [opts.rules.lower=[]] - Segments to force to lowercase (supports globs and **STRING** boundary patterns)
|
|
15
|
-
* @returns {string} Valid JavaScript identifier safe for dot-notation property access
|
|
16
|
-
* @throws {TypeError} When input parameter is not a string
|
|
17
|
-
*
|
|
18
|
-
* @description
|
|
19
|
-
* Sanitize a string into a JS identifier suitable for dot-path usage.
|
|
20
|
-
* Advanced sanitization function that applies rules intelligently before splitting while
|
|
21
|
-
* maintaining proper camelCase transformation. Uses sophisticated tracking to ensure
|
|
22
|
-
* rule-matched segments are preserved correctly through the transformation process.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* // Basic sanitization (already valid identifiers unchanged)
|
|
26
|
-
* sanitizePathName("autoIP"); // "autoIP" (no change needed)
|
|
27
|
-
* sanitizePathName("validIdentifier"); // "validIdentifier" (no change needed)
|
|
28
|
-
* sanitizePathName("auto_ip"); // "auto_ip" (valid identifier preserved)
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* // Standard camelCase conversion
|
|
32
|
-
* sanitizePathName("auto-ip"); // "autoIp" (dash becomes camelCase)
|
|
33
|
-
* sanitizePathName("my file!.mjs"); // "myFileMjs" (spaces and special chars removed)
|
|
34
|
-
* sanitizePathName("foo-bar-baz"); // "fooBarBaz" (multi-segment camelCase)
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* // Pre-split pattern matching (matches original filename patterns)
|
|
38
|
-
* sanitizePathName("auto-ip", {
|
|
39
|
-
* rules: {
|
|
40
|
-
* upper: ["*-ip"] // Matches before splitting
|
|
41
|
-
* }
|
|
42
|
-
* }); // Result: "autoIP" (ip becomes IP due to *-ip pattern)
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* // Complex pattern matching with intelligent tracking
|
|
46
|
-
* sanitizePathName("get-api-status", {
|
|
47
|
-
* rules: {
|
|
48
|
-
* upper: ["*-api-*"] // Matches api in middle of filename
|
|
49
|
-
* }
|
|
50
|
-
* }); // Result: "getAPIStatus" (api becomes API due to pattern)
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* // Automatic case preservation
|
|
54
|
-
* sanitizePathName("COMMON_APPS", { preserveAllUpper: true }); // "COMMON_APPS" (preserved)
|
|
55
|
-
* sanitizePathName("cOMMON_APPS", { preserveAllUpper: true }); // "cOMMON_APPS" (not all-uppercase, transformed)
|
|
56
|
-
* sanitizePathName("common_apps", { preserveAllLower: true }); // "common_apps" (preserved)
|
|
57
|
-
* sanitizePathName("Common_apps", { preserveAllLower: true }); // "commonApps" (not all-lowercase, transformed)
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* // Combining preserve options with other rules
|
|
61
|
-
* sanitizePathName("parse-XML-data", {
|
|
62
|
-
* preserveAllUpper: true,
|
|
63
|
-
* rules: { upper: ["xml"] }
|
|
64
|
-
* }); // "parseXMLData" (XML preserved by preserveAllUpper)
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* // Boundary-requiring patterns with **STRING** syntax
|
|
68
|
-
* sanitizePathName("buildUrlWithParams", {
|
|
69
|
-
* rules: {
|
|
70
|
-
* upper: ["**url**"] // Only matches "url" when surrounded by other characters
|
|
71
|
-
* }
|
|
72
|
-
* }); // Result: "buildURLWithParams" (url becomes URL, surrounded by other chars)
|
|
73
|
-
*
|
|
74
|
-
* sanitizePathName("url", {
|
|
75
|
-
* rules: {
|
|
76
|
-
* upper: ["**url**"] // Does NOT match standalone "url" (no surrounding chars)
|
|
77
|
-
* }
|
|
78
|
-
* }); // Result: "url" (unchanged - no surrounding characters)
|
|
79
|
-
*
|
|
80
|
-
* sanitizePathName("parseJsonData", {
|
|
81
|
-
* rules: {
|
|
82
|
-
* upper: ["**json**"] // Matches "json" surrounded by other characters
|
|
83
|
-
* }
|
|
84
|
-
* }); // Result: "parseJSONData" (json becomes JSON)
|
|
2
|
+
* Standalone sanitizePropertyName function for backward compatibility
|
|
3
|
+
* @param {string} input - Input string to sanitize
|
|
4
|
+
* @param {object} options - Sanitization options
|
|
5
|
+
* @returns {string} Sanitized property name
|
|
6
|
+
* @public
|
|
85
7
|
*/
|
|
86
|
-
export function
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
8
|
+
export function sanitizePropertyName(input: string, options?: object): string;
|
|
9
|
+
/**
|
|
10
|
+
* Advanced filename sanitization with rule-based transformation
|
|
11
|
+
* @extends ComponentBase
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export class Sanitize extends ComponentBase {
|
|
15
|
+
static slothletProperty: string;
|
|
16
|
+
/**
|
|
17
|
+
* Advanced sanitization function with configurable rule-based transformation
|
|
18
|
+
*
|
|
19
|
+
* @description
|
|
20
|
+
* Converts arbitrary strings (filenames, path segments) into valid JavaScript identifiers
|
|
21
|
+
* suitable for dot-notation property access. Supports sophisticated rule-based transformation
|
|
22
|
+
* with glob patterns, case preservation, and intelligent segment handling.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} input - String to sanitize
|
|
25
|
+
* @param {Object} [options={}] - Sanitization configuration
|
|
26
|
+
* @param {boolean} [options.lowerFirst=true] - Lowercase first character of first segment
|
|
27
|
+
* @param {boolean} [options.preserveAllUpper=false] - Preserve all-uppercase identifiers
|
|
28
|
+
* @param {boolean} [options.preserveAllLower=false] - Preserve all-lowercase identifiers
|
|
29
|
+
* @param {Object} [options.rules={}] - Transformation rules
|
|
30
|
+
* @param {string[]} [options.rules.leave=[]] - Preserve exactly (case-sensitive, supports globs)
|
|
31
|
+
* @param {string[]} [options.rules.leaveInsensitive=[]] - Preserve exactly (case-insensitive, supports globs)
|
|
32
|
+
* @param {string[]} [options.rules.upper=[]] - Force UPPERCASE (supports globs and **STRING**)
|
|
33
|
+
* @param {string[]} [options.rules.lower=[]] - Force lowercase (supports globs and **STRING**)
|
|
34
|
+
* @returns {string} Valid JavaScript identifier
|
|
35
|
+
* @public
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // Basic usage
|
|
39
|
+
* sanitizePropertyName("auto-ip"); // "autoIp"
|
|
40
|
+
* sanitizePropertyName("root-math"); // "rootMath"
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* // Rule-based transformation
|
|
44
|
+
* sanitizePropertyName("auto-ip", {
|
|
45
|
+
* rules: { upper: ["*-ip"] }
|
|
46
|
+
* }); // "autoIP"
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* // Boundary-requiring patterns
|
|
50
|
+
* sanitizePropertyName("parseJsonData", {
|
|
51
|
+
* rules: { upper: ["**json**"] }
|
|
52
|
+
* }); // "parseJSONData"
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* // Case preservation
|
|
56
|
+
* sanitizePropertyName("COMMON_APPS", {
|
|
57
|
+
* preserveAllUpper: true
|
|
58
|
+
* }); // "COMMON_APPS"
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* // Multiple rules
|
|
62
|
+
* sanitizePropertyName("get-api-status", {
|
|
63
|
+
* rules: {
|
|
64
|
+
* upper: ["*-api-*", "http"],
|
|
65
|
+
* lower: ["xml"]
|
|
66
|
+
* }
|
|
67
|
+
* }); // "getAPIStatus"
|
|
68
|
+
*/
|
|
69
|
+
public sanitizePropertyName(input: string, options?: {
|
|
70
|
+
lowerFirst?: boolean;
|
|
71
|
+
preserveAllUpper?: boolean;
|
|
72
|
+
preserveAllLower?: boolean;
|
|
73
|
+
rules?: {
|
|
74
|
+
leave?: string[];
|
|
75
|
+
leaveInsensitive?: string[];
|
|
76
|
+
upper?: string[];
|
|
77
|
+
lower?: string[];
|
|
78
|
+
};
|
|
79
|
+
}): string;
|
|
80
|
+
/**
|
|
81
|
+
* Get module ID from file path
|
|
82
|
+
* @param {string} filePath - Full file path
|
|
83
|
+
* @param {string} baseDir - Base directory
|
|
84
|
+
* @returns {string} Module ID
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
public getModuleId(filePath: string, baseDir: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* Check if filename represents a special function name that should preserve case
|
|
90
|
+
* @param {string} name - Name to check
|
|
91
|
+
* @returns {boolean} True if special case should be preserved
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
public shouldPreserveFunctionCase(name: string): boolean;
|
|
95
|
+
#private;
|
|
96
|
+
}
|
|
97
|
+
import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
|
|
97
98
|
//# sourceMappingURL=sanitize.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/sanitize.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sanitize.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/sanitize.mjs"],"names":[],"mappings":"AAkcA;;;;;;GAMG;AACH,4CALW,MAAM,YACN,MAAM,GACJ,MAAM,CAMlB;AAnbD;;;;GAIG;AACH;IACC,gCAAqC;IA6LrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoDG;IACH,mCA7CW,MAAM,YAEd;QAA0B,UAAU,GAA5B,OAAO;QACW,gBAAgB,GAAlC,OAAO;QACW,gBAAgB,GAAlC,OAAO;QACU,KAAK,GAC9B;YAAiC,KAAK,GAA9B,MAAM,EAAE;YACiB,gBAAgB,GAAzC,MAAM,EAAE;YACiB,KAAK,GAA9B,MAAM,EAAE;YACiB,KAAK,GAA9B,MAAM,EAAE;SAChB;KAAA,GAAU,MAAM,CA8KlB;IAED;;;;;;OAMG;IACH,6BALW,MAAM,WACN,MAAM,GACJ,MAAM,CAUlB;IAED;;;;;OAKG;IACH,wCAJW,MAAM,GACJ,OAAO,CAUnB;;CACD;8BAza6B,0CAA0C"}
|
|
@@ -1,120 +1,57 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @Author: Nate Hyson <CLDMV>
|
|
6
|
-
* @Email: <Shinrai@users.noreply.github.com>
|
|
7
|
-
* -----
|
|
8
|
-
* @Last modified by: Nate Hyson <CLDMV> (Shinrai@users.noreply.github.com)
|
|
9
|
-
* @Last modified time: 2025-12-30 08:54:56 -08:00 (1767113696)
|
|
10
|
-
* -----
|
|
11
|
-
* @Copyright: Copyright (c) 2013-2025 Catalyzed Motivation Inc. All rights reserved.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* @fileoverview Utility functions for property manipulation and object operations.
|
|
15
|
-
* @module @cldmv/slothlet/lib/helpers/utilities
|
|
16
|
-
* @memberof module:@cldmv/slothlet.lib.helpers
|
|
17
|
-
* @internal
|
|
18
|
-
* @private
|
|
19
|
-
*
|
|
20
|
-
* @description
|
|
21
|
-
* Provides general-purpose utility functions for safe property definition, deep object merging,
|
|
22
|
-
* and live-binding variable mutation. These utilities are used throughout slothlet for
|
|
23
|
-
* object manipulation, property management, and live-binding operations.
|
|
24
|
-
*
|
|
25
|
-
* Exported Functions:
|
|
26
|
-
* - safeDefine: Safe property definition handling non-configurable properties
|
|
27
|
-
* - deepMerge: Recursive deep merge for object combining
|
|
28
|
-
* - mutateLiveBindingFunction: Live-binding variable mutation preserving references
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* // Internal usage in slothlet
|
|
32
|
-
* import { safeDefine, deepMerge, mutateLiveBindingFunction } from "./utilities.mjs";
|
|
33
|
-
*
|
|
34
|
-
* safeDefine(api, "shutdown", shutdownFunction, false);
|
|
35
|
-
* const merged = deepMerge(target, source);
|
|
36
|
-
* mutateLiveBindingFunction(boundapi, newApi);
|
|
37
|
-
*/
|
|
38
|
-
/**
|
|
39
|
-
* Safely defines a property on an object, handling non-configurable properties.
|
|
40
|
-
*
|
|
41
|
-
* @function safeDefine
|
|
42
|
-
* @memberof module:@cldmv/slothlet.lib.helpers.utilities
|
|
43
|
-
* @param {object} obj - Target object
|
|
44
|
-
* @param {string} key - Property key
|
|
45
|
-
* @param {*} value - Property value
|
|
46
|
-
* @param {boolean} [enumerable=false] - Whether the property should be enumerable (default: false for management methods)
|
|
47
|
-
* @param {object} [config=null] - Optional configuration object with debug flag
|
|
48
|
-
* @package
|
|
49
|
-
*
|
|
50
|
-
* @description
|
|
51
|
-
* Attempts to define a property on an object with the specified configuration.
|
|
52
|
-
* Handles cases where the property is non-configurable by logging a warning
|
|
53
|
-
* instead of throwing an error. Used for safely attaching management methods
|
|
54
|
-
* like shutdown, addApi, and describe to API objects.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* // Internal usage
|
|
58
|
-
* import { safeDefine } from "./utilities.mjs";
|
|
59
|
-
*
|
|
60
|
-
* safeDefine(api, "shutdown", shutdownFunction, false, { debug: true });
|
|
61
|
-
*/
|
|
62
|
-
export function safeDefine(obj: object, key: string, value: any, enumerable?: boolean, config?: object): void;
|
|
63
|
-
/**
|
|
64
|
-
* Deep merge two objects recursively.
|
|
65
|
-
*
|
|
66
|
-
* @function deepMerge
|
|
67
|
-
* @memberof module:@cldmv/slothlet.lib.helpers.utilities
|
|
68
|
-
* @param {object} target - Target object to merge into
|
|
69
|
-
* @param {object} source - Source object to merge from
|
|
70
|
-
* @returns {object} Merged object (mutates target)
|
|
71
|
-
* @package
|
|
72
|
-
*
|
|
73
|
-
* @description
|
|
74
|
-
* Performs a recursive deep merge of two objects, combining nested structures.
|
|
75
|
-
* Arrays are treated as primitive values and replaced rather than merged.
|
|
76
|
-
* Used for context merging in scope operations.
|
|
77
|
-
*
|
|
78
|
-
* **Security Note**: This function explicitly blocks the `__proto__`, `prototype`, and
|
|
79
|
-
* `constructor` keys to prevent prototype pollution attacks. Any attempt to merge
|
|
80
|
-
* these dangerous keys will be silently ignored.
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* // Internal usage
|
|
84
|
-
* import { deepMerge } from "./utilities.mjs";
|
|
85
|
-
*
|
|
86
|
-
* const target = { a: 1, b: { c: 2 } };
|
|
87
|
-
* const source = { b: { d: 3 }, e: 4 };
|
|
88
|
-
* const merged = deepMerge(target, source);
|
|
89
|
-
* // Result: { a: 1, b: { c: 2, d: 3 }, e: 4 }
|
|
90
|
-
*/
|
|
91
|
-
export function deepMerge(target: object, source: object): object;
|
|
92
|
-
/**
|
|
93
|
-
* Mutates a live-binding variable (object or function) to match a new value, preserving reference.
|
|
94
|
-
*
|
|
95
|
-
* @function mutateLiveBindingFunction
|
|
96
|
-
* @memberof module:@cldmv/slothlet.lib.helpers.utilities
|
|
97
|
-
* @param {function|object} target - The variable to mutate (object or function)
|
|
98
|
-
* @param {function|object} source - The new value to copy from (object or function)
|
|
2
|
+
* General utility functions
|
|
3
|
+
* @class Utilities
|
|
4
|
+
* @extends ComponentBase
|
|
99
5
|
* @package
|
|
100
|
-
*
|
|
101
|
-
* @description
|
|
102
|
-
* Mutates an existing live-binding variable to match a new structure while
|
|
103
|
-
* preserving the original reference. This is critical for maintaining live
|
|
104
|
-
* bindings in modules that have imported self, context, or reference.
|
|
105
|
-
*
|
|
106
|
-
* For functions: Sets _impl to call source, removes old properties (except _impl and __ctx),
|
|
107
|
-
* and attaches new properties from source.
|
|
108
|
-
*
|
|
109
|
-
* For objects: Removes old properties (except _impl and __ctx), attaches new properties,
|
|
110
|
-
* and manually copies management methods (shutdown, addApi, describe).
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* // Internal usage
|
|
114
|
-
* import { mutateLiveBindingFunction } from "./utilities.mjs";
|
|
115
|
-
*
|
|
116
|
-
* mutateLiveBindingFunction(self, newSelf);
|
|
117
|
-
* mutateLiveBindingFunction(boundapi, newApi);
|
|
118
6
|
*/
|
|
119
|
-
export
|
|
7
|
+
export class Utilities extends ComponentBase {
|
|
8
|
+
static slothletProperty: string;
|
|
9
|
+
/**
|
|
10
|
+
* Check if value is a plain object
|
|
11
|
+
* @param {*} obj - Value to check
|
|
12
|
+
* @returns {boolean} True if plain object
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
public isPlainObject(obj: any): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Deep merge two plain objects recursively.
|
|
18
|
+
*
|
|
19
|
+
* Differences from a simple spread:
|
|
20
|
+
* - Recursively merges nested plain objects rather than replacing them.
|
|
21
|
+
* - Uses `hasOwnProperty` to skip prototype-chain keys (no prototype pollution).
|
|
22
|
+
* - Non-plain values (arrays, class instances, primitives) are always copied by
|
|
23
|
+
* value from `source`, never merged.
|
|
24
|
+
* - When `source[key]` is a plain object but `target[key]` is not (or absent),
|
|
25
|
+
* the merge starts from `{}` so the returned sub-tree is always a fresh copy.
|
|
26
|
+
* - If either top-level argument is not a plain object, returns `source` as-is.
|
|
27
|
+
*
|
|
28
|
+
* @param {Object} target - Base object (not mutated).
|
|
29
|
+
* @param {Object} source - Source object whose keys are merged in.
|
|
30
|
+
* @returns {Object} New merged object.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
public deepMerge(target: any, source: any): any;
|
|
34
|
+
/**
|
|
35
|
+
* Deep clone a value, handling Proxy objects and functions that `structuredClone`
|
|
36
|
+
* cannot serialise.
|
|
37
|
+
*
|
|
38
|
+
* Strategy:
|
|
39
|
+
* 1. Try `structuredClone` — fast and spec-correct for plain data.
|
|
40
|
+
* 2. Fall back to a manual recursive copy for Proxies, callables, and other
|
|
41
|
+
* non-serialisable objects; errors on individual property clones are swallowed
|
|
42
|
+
* and the original reference is retained for that key.
|
|
43
|
+
*
|
|
44
|
+
* @param {unknown} obj - Value to clone.
|
|
45
|
+
* @returns {unknown} Deep clone of `obj`.
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
public deepClone(obj: unknown): unknown;
|
|
49
|
+
/**
|
|
50
|
+
* Generate unique ID
|
|
51
|
+
* @returns {string} Unique identifier
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
public generateId(): string;
|
|
55
|
+
}
|
|
56
|
+
import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
|
|
120
57
|
//# sourceMappingURL=utilities.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/utilities.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utilities.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/utilities.mjs"],"names":[],"mappings":"AAsBA;;;;;GAKG;AACH;IACC,gCAAsC;IAEtC;;;;;OAKG;IACH,0BAJW,GAAC,GACC,OAAO,CAOnB;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,gDAoBC;IAED;;;;;;;;;;;;;OAaG;IACH,sBAJW,OAAO,GACL,OAAO,CAyBnB;IAED;;;;OAIG;IACH,qBAHa,MAAM,CAKlB;CACD;8BA5G6B,0CAA0C"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Set current language (synchronous)
|
|
3
|
+
* Merges requested language translations over default English translations
|
|
4
|
+
* @param {string} lang - Language code
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export function setLanguage(lang: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* Get current language
|
|
10
|
+
* @returns {string} Language code
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export function getLanguage(): string;
|
|
14
|
+
/**
|
|
15
|
+
* Translate error message with interpolation
|
|
16
|
+
* @param {string} errorCode - Error code
|
|
17
|
+
* @param {Object} params - Parameters for interpolation
|
|
18
|
+
* @returns {string} Translated message
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export function translate(errorCode: string, params?: any): string;
|
|
22
|
+
/**
|
|
23
|
+
* Initialize i18n system (synchronous)
|
|
24
|
+
* @param {Object} options - Options
|
|
25
|
+
* @param {string} [options.language] - Language code (auto-detect if not provided)
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export function initI18n(options?: {
|
|
29
|
+
language?: string;
|
|
30
|
+
}): void;
|
|
31
|
+
/**
|
|
32
|
+
* Translate error message with interpolation
|
|
33
|
+
* @param {string} errorCode - Error code
|
|
34
|
+
* @param {Object} params - Parameters for interpolation
|
|
35
|
+
* @returns {string} Translated message
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export function t(errorCode: string, params?: any): string;
|
|
39
|
+
//# sourceMappingURL=translations.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translations.d.mts","sourceRoot":"","sources":["../../../../dist/lib/i18n/translations.mjs"],"names":[],"mappings":"AAqFA;;;;;GAKG;AACH,kCAHW,MAAM,QAsBhB;AAED;;;;GAIG;AACH,+BAHa,MAAM,CAKlB;AAED;;;;;;GAMG;AACH,qCALW,MAAM,iBAEJ,MAAM,CAyBlB;AAED;;;;;GAKG;AACH,mCAHG;IAAyB,QAAQ,GAAzB,MAAM;CACd,QAiBF;AApDD;;;;;;GAMG;AACH,6BALW,MAAM,iBAEJ,MAAM,CAyBlB"}
|