@cldmv/slothlet 2.10.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 +365 -294
- package/README.md +556 -233
- 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 +125 -85
- 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 +529 -700
- package/docs/API-RULES.md +497 -617
- package/index.cjs +4 -4
- package/index.mjs +82 -45
- package/package.json +139 -26
- 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 +186 -105
- 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 -292
- package/dist/lib/helpers/api_builder/analysis.mjs +0 -532
- package/dist/lib/helpers/api_builder/construction.mjs +0 -457
- package/dist/lib/helpers/api_builder/decisions.mjs +0 -737
- 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 -126
- package/dist/lib/modes/slothlet_lazy.mjs +0 -513
- package/docs/API-RULES-CONDITIONS.md +0 -508
- 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 -76
- 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
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
export namespace metadataAPI {
|
|
2
|
-
/**
|
|
3
|
-
* Get metadata of the function that called the current function.
|
|
4
|
-
*
|
|
5
|
-
* @function caller
|
|
6
|
-
* @memberof metadataAPI
|
|
7
|
-
* @returns {object|null} Caller's metadata object or null if not found
|
|
8
|
-
* @public
|
|
9
|
-
*
|
|
10
|
-
* @description
|
|
11
|
-
* Uses stack trace analysis to identify the calling function and retrieve
|
|
12
|
-
* its attached metadata. Useful for implementing access control where a
|
|
13
|
-
* function needs to verify the identity/permissions of its caller.
|
|
14
|
-
*
|
|
15
|
-
* Stack trace structure:
|
|
16
|
-
* - Line 0: Error
|
|
17
|
-
* - Line 1: metadataAPI.caller (this function)
|
|
18
|
-
* - Line 2: Current function (the one checking)
|
|
19
|
-
* - Line 3: The caller we want to identify
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* // In a secure function
|
|
23
|
-
* import { metadataAPI } from "@cldmv/slothlet/runtime";
|
|
24
|
-
*
|
|
25
|
-
* export function getSecrets() {
|
|
26
|
-
* const caller = metadataAPI.caller();
|
|
27
|
-
*
|
|
28
|
-
* if (!caller?.trusted) {
|
|
29
|
-
* throw new Error("Access denied: untrusted caller");
|
|
30
|
-
* }
|
|
31
|
-
*
|
|
32
|
-
* if (!caller.permissions?.includes("read_secrets")) {
|
|
33
|
-
* throw new Error("Access denied: insufficient permissions");
|
|
34
|
-
* }
|
|
35
|
-
*
|
|
36
|
-
* return { apiKey: "secret123", token: "xyz" };
|
|
37
|
-
* }
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* // With custom metadata tags
|
|
41
|
-
* const caller = metadataAPI.caller();
|
|
42
|
-
* console.log("Caller source:", caller?.sourceFolder);
|
|
43
|
-
* console.log("Caller version:", caller?.version);
|
|
44
|
-
* console.log("Caller author:", caller?.author);
|
|
45
|
-
*/
|
|
46
|
-
function caller(): object | null;
|
|
47
|
-
/**
|
|
48
|
-
* Get metadata of the current function.
|
|
49
|
-
*
|
|
50
|
-
* @function self
|
|
51
|
-
* @memberof metadataAPI
|
|
52
|
-
* @returns {object|null} Current function's metadata or null if not found
|
|
53
|
-
* @public
|
|
54
|
-
*
|
|
55
|
-
* @description
|
|
56
|
-
* Retrieves metadata attached to the currently executing function. Useful
|
|
57
|
-
* for functions that need to inspect their own metadata (e.g., for logging,
|
|
58
|
-
* conditional behavior based on load source).
|
|
59
|
-
*
|
|
60
|
-
* Stack trace structure:
|
|
61
|
-
* - Line 0: Error
|
|
62
|
-
* - Line 1: metadataAPI.self (this function)
|
|
63
|
-
* - Line 2: Current function (the one we want to identify)
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* // Function checking its own metadata
|
|
67
|
-
* import { metadataAPI } from "@cldmv/slothlet/runtime";
|
|
68
|
-
*
|
|
69
|
-
* export function smartFunction() {
|
|
70
|
-
* const meta = metadataAPI.self();
|
|
71
|
-
*
|
|
72
|
-
* if (meta?.environment === "development") {
|
|
73
|
-
* console.log("Running in development mode");
|
|
74
|
-
* }
|
|
75
|
-
*
|
|
76
|
-
* if (meta?.version) {
|
|
77
|
-
* console.log(`Function version: ${meta.version}`);
|
|
78
|
-
* }
|
|
79
|
-
*
|
|
80
|
-
* return "result";
|
|
81
|
-
* }
|
|
82
|
-
*/
|
|
83
|
-
function self(): object | null;
|
|
84
|
-
/**
|
|
85
|
-
* Get metadata of any function by API path.
|
|
86
|
-
*
|
|
87
|
-
* @function get
|
|
88
|
-
* @memberof metadataAPI
|
|
89
|
-
* @param {string} path - Dot-notation API path (e.g., "math.add", "plugins.helper")
|
|
90
|
-
* @param {object} [apiRoot] - Optional API root object (uses runtime.self if not provided)
|
|
91
|
-
* @returns {object|null} Function's metadata or null if not found
|
|
92
|
-
* @public
|
|
93
|
-
*
|
|
94
|
-
* @description
|
|
95
|
-
* Retrieves metadata for any function in the API tree by its path. Useful
|
|
96
|
-
* for checking metadata of functions you have references to, or for
|
|
97
|
-
* administrative/introspection purposes.
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* // Check metadata of a specific function
|
|
101
|
-
* import { metadataAPI } from "@cldmv/slothlet/runtime";
|
|
102
|
-
*
|
|
103
|
-
* export function checkPermissions() {
|
|
104
|
-
* const pluginMeta = metadataAPI.get("plugins.userPlugin");
|
|
105
|
-
*
|
|
106
|
-
* if (!pluginMeta) {
|
|
107
|
-
* throw new Error("Plugin not found or has no metadata");
|
|
108
|
-
* }
|
|
109
|
-
*
|
|
110
|
-
* if (pluginMeta.trusted) {
|
|
111
|
-
* console.log("Plugin is trusted");
|
|
112
|
-
* } else {
|
|
113
|
-
* console.log("Plugin is untrusted");
|
|
114
|
-
* }
|
|
115
|
-
* }
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* // Iterate and check all plugins
|
|
119
|
-
* const pluginPaths = ["plugins.auth", "plugins.logger", "plugins.cache"];
|
|
120
|
-
* for (const path of pluginPaths) {
|
|
121
|
-
* const meta = metadataAPI.get(path);
|
|
122
|
-
* console.log(`${path}: ${meta?.version || "unknown"}`);
|
|
123
|
-
* }
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* // From outside slothlet context, pass API root explicitly
|
|
127
|
-
* const api = await slothlet({ dir: "./modules" });
|
|
128
|
-
* const meta = await metadataAPI.get("plugins.helper", api);
|
|
129
|
-
*/
|
|
130
|
-
function get(path: string, apiRoot?: object): object | null;
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=metadata-api.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metadata-api.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/metadata-api.mjs"],"names":[],"mappings":";IAmNC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;IACH,mBAvCa,MAAM,GAAC,IAAI,CAgEvB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,iBA/Ba,MAAM,GAAC,IAAI,CAsDvB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACH,mBAzCW,MAAM,YACN,MAAM,GACJ,MAAM,GAAC,IAAI,CAsDvB"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Analyzes module files to detect multi-default and self-referential patterns.
|
|
3
|
-
* @internal
|
|
4
|
-
* @private
|
|
5
|
-
* @param {Array<{name: string}>} moduleFiles - Array of module file objects with name property
|
|
6
|
-
* @param {string} baseDir - Base directory path containing the modules
|
|
7
|
-
* @param {object} [options={}] - Configuration options
|
|
8
|
-
* @param {boolean} [options.debug=false] - Enable debug logging
|
|
9
|
-
* @param {object|null} [options.instance=null] - Slothlet instance for cache isolation
|
|
10
|
-
* @returns {Promise<{
|
|
11
|
-
* totalDefaultExports: number,
|
|
12
|
-
* hasMultipleDefaultExports: boolean,
|
|
13
|
-
* selfReferentialFiles: Set<string>,
|
|
14
|
-
* rawModuleCache: Map<string, object>,
|
|
15
|
-
* defaultExportFiles: Array<{fileName: string, rawModule: object}>
|
|
16
|
-
* }>} Analysis results
|
|
17
|
-
* @example // Internal usage in slothlet modes
|
|
18
|
-
* const analysis = await multidefault_analyzeModules(moduleFiles, categoryPath, { debug: config.debug, instance });
|
|
19
|
-
* if (analysis.hasMultipleDefaultExports) {
|
|
20
|
-
* // Handle multi-default context
|
|
21
|
-
* }
|
|
22
|
-
*/
|
|
23
|
-
export function multidefault_analyzeModules(moduleFiles: Array<{
|
|
24
|
-
name: string;
|
|
25
|
-
}>, baseDir: string, options?: {
|
|
26
|
-
debug?: boolean;
|
|
27
|
-
instance?: object | null;
|
|
28
|
-
}): Promise<{
|
|
29
|
-
totalDefaultExports: number;
|
|
30
|
-
hasMultipleDefaultExports: boolean;
|
|
31
|
-
selfReferentialFiles: Set<string>;
|
|
32
|
-
rawModuleCache: Map<string, object>;
|
|
33
|
-
defaultExportFiles: Array<{
|
|
34
|
-
fileName: string;
|
|
35
|
-
rawModule: object;
|
|
36
|
-
}>;
|
|
37
|
-
}>;
|
|
38
|
-
/**
|
|
39
|
-
* Checks if a raw module's default export is self-referential (points to a named export).
|
|
40
|
-
* @internal
|
|
41
|
-
* @private
|
|
42
|
-
* @param {object} rawModule - Raw module object to check
|
|
43
|
-
* @returns {boolean} True if default export points to a named export
|
|
44
|
-
* @example // Internal usage
|
|
45
|
-
* const isSelfRef = multidefault_isSelfReferential(rawModule);
|
|
46
|
-
*/
|
|
47
|
-
export function multidefault_isSelfReferential(rawModule: object): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Determines auto-flattening behavior based on multi-default context and module structure.
|
|
50
|
-
* @internal
|
|
51
|
-
* @private
|
|
52
|
-
* @param {object} options - Configuration options
|
|
53
|
-
* @param {boolean} options.hasMultipleDefaultExports - Whether multiple default exports exist
|
|
54
|
-
* @param {boolean} options.moduleHasDefault - Whether current module has default export
|
|
55
|
-
* @param {boolean} options.isSelfReferential - Whether current module is self-referential
|
|
56
|
-
* @param {Array<string>} options.moduleKeys - Named export keys from the module
|
|
57
|
-
* @param {string} options.apiPathKey - API key for the module
|
|
58
|
-
* @param {number} options.totalModuleCount - Total number of modules in directory
|
|
59
|
-
* @param {boolean} [options.debug=false] - Enable debug logging
|
|
60
|
-
* @returns {{
|
|
61
|
-
* shouldFlatten: boolean,
|
|
62
|
-
* flattenToRoot: boolean,
|
|
63
|
-
* preserveAsNamespace: boolean,
|
|
64
|
-
* reason: string
|
|
65
|
-
* }} Flattening decision and reasoning
|
|
66
|
-
* @example // Internal usage in processing logic
|
|
67
|
-
* const decision = multidefault_getFlatteningDecision({
|
|
68
|
-
* hasMultipleDefaultExports: true,
|
|
69
|
-
* moduleHasDefault: false,
|
|
70
|
-
* isSelfReferential: false,
|
|
71
|
-
* moduleKeys: ["add", "subtract"],
|
|
72
|
-
* apiPathKey: "math",
|
|
73
|
-
* totalModuleCount: 3
|
|
74
|
-
* });
|
|
75
|
-
*/
|
|
76
|
-
export function multidefault_getFlatteningDecision(options: {
|
|
77
|
-
hasMultipleDefaultExports: boolean;
|
|
78
|
-
moduleHasDefault: boolean;
|
|
79
|
-
isSelfReferential: boolean;
|
|
80
|
-
moduleKeys: Array<string>;
|
|
81
|
-
apiPathKey: string;
|
|
82
|
-
totalModuleCount: number;
|
|
83
|
-
debug?: boolean;
|
|
84
|
-
}): {
|
|
85
|
-
shouldFlatten: boolean;
|
|
86
|
-
flattenToRoot: boolean;
|
|
87
|
-
preserveAsNamespace: boolean;
|
|
88
|
-
reason: string;
|
|
89
|
-
};
|
|
90
|
-
//# sourceMappingURL=multidefault.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multidefault.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/multidefault.mjs"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,yDAlBW,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC,WACrB,MAAM,YAEd;IAA0B,KAAK,GAAvB,OAAO;IACe,QAAQ,GAA9B,MAAM,GAAC,IAAI;CACnB,GAAU,OAAO,CAAC;IAChB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yBAAyB,EAAE,OAAO,CAAC;IACnC,oBAAoB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,kBAAkB,EAAE,KAAK,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAC,CAAC,CAAA;CACjE,CAAC,CAuGJ;AAED;;;;;;;;GAQG;AACH,0DALW,MAAM,GACJ,OAAO,CAWnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,4DAvBG;IAAyB,yBAAyB,EAA1C,OAAO;IACU,gBAAgB,EAAjC,OAAO;IACU,iBAAiB,EAAlC,OAAO;IACgB,UAAU,EAAjC,KAAK,CAAC,MAAM,CAAC;IACG,UAAU,EAA1B,MAAM;IACU,gBAAgB,EAAhC,MAAM;IACY,KAAK,GAAvB,OAAO;CACf,GAAU;IACR,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAA;CACf,CA4FH"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @function eager_wrapWithRunCtx
|
|
3
|
-
* @internal
|
|
4
|
-
* @package
|
|
5
|
-
* @alias module:@cldmv/slothlet.modes.eager.eager_wrapWithRunCtx
|
|
6
|
-
* @memberof module:@cldmv/slothlet.modes.eager
|
|
7
|
-
* @param {*} obj - The object/function to wrap
|
|
8
|
-
* @param {object} instance - The slothlet instance that will have boundapi.__ctx attached
|
|
9
|
-
* @returns {*} The wrapped object/function
|
|
10
|
-
*
|
|
11
|
-
* @description
|
|
12
|
-
* Recursively wraps all functions in an object with runWithCtx for eager mode.
|
|
13
|
-
* This makes eager mode use the same call stack optimization as lazy mode.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* // Wrapping a function
|
|
17
|
-
* const wrappedFn = eager_wrapWithRunCtx(originalFunction, instance);
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // Wrapping an object with nested functions
|
|
21
|
-
* const wrappedObj = eager_wrapWithRunCtx({ method: fn }, instance);
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* // Wrapping a function
|
|
25
|
-
* const wrappedFn = eager_wrapWithRunCtx(originalFunction, instance);
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* // Wrapping an object with nested functions
|
|
29
|
-
* const wrappedObj = eager_wrapWithRunCtx({ method: fn }, instance);
|
|
30
|
-
* const wrappedFn = eager_wrapWithRunCtx(originalFunction, instance);
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* // Wrapping an object with nested functions
|
|
34
|
-
* const wrappedObj = eager_wrapWithRunCtx({ method: fn }, instance);
|
|
35
|
-
*/
|
|
36
|
-
/**
|
|
37
|
-
* @function create
|
|
38
|
-
* @internal
|
|
39
|
-
* @package
|
|
40
|
-
* @async
|
|
41
|
-
* @alias module:@cldmv/slothlet.modes.eager.create
|
|
42
|
-
* @memberof module:@cldmv/slothlet.modes.eager
|
|
43
|
-
* @param {string} dir - Directory to load
|
|
44
|
-
* @param {number} [maxDepth=Infinity] - Maximum depth to traverse
|
|
45
|
-
* @param {number} [currentDepth=0] - Current traversal depth
|
|
46
|
-
* @returns {Promise<object>} Complete API object with all modules loaded
|
|
47
|
-
* @throws {Error} When module loading or directory traversal fails
|
|
48
|
-
*
|
|
49
|
-
* @description
|
|
50
|
-
* Creates the eager API for slothlet (mode: eager).
|
|
51
|
-
* Immediately loads all modules and constructs the complete API structure.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* // Internal usage - called by slothlet core
|
|
55
|
-
* const api = await create('./api_test', 3, 0);
|
|
56
|
-
* // Returns: { math: { add: [Function], multiply: [Function] }, ... }
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* // Root-level processing with function exports
|
|
60
|
-
* const api = await create('./api_test');
|
|
61
|
-
* // If root has default function: api becomes that function with properties
|
|
62
|
-
* // Otherwise: api is object with module properties
|
|
63
|
-
*/
|
|
64
|
-
export function create(dir: string, maxDepth?: number, currentDepth?: number): Promise<object>;
|
|
65
|
-
//# sourceMappingURL=slothlet_eager.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slothlet_eager.d.mts","sourceRoot":"","sources":["../../../../dist/lib/modes/slothlet_eager.mjs"],"names":[],"mappings":"AA4IA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAsDH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,4BArBW,MAAM,aACN,MAAM,iBACN,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAgH3B"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @function create
|
|
3
|
-
* @internal
|
|
4
|
-
* @package
|
|
5
|
-
* @async
|
|
6
|
-
* @alias module:@cldmv/slothlet.modes.lazy.create
|
|
7
|
-
* @memberof module:@cldmv/slothlet.modes.lazy
|
|
8
|
-
* @param {string} dir - Root directory
|
|
9
|
-
* @param {number} [maxDepth=Infinity] - Maximum depth to traverse
|
|
10
|
-
* @param {number} [currentDepth=0] - Current depth (for internal recursion only)
|
|
11
|
-
* @returns {Promise<function|object>} Root API object or function (if default export)
|
|
12
|
-
* @throws {Error} When module loading or directory traversal fails
|
|
13
|
-
*
|
|
14
|
-
* @description
|
|
15
|
-
* Creates a lazy API structure. Root-level files are loaded immediately (mirrors eager).
|
|
16
|
-
* Directories become lazy proxies. Nested directories remain lazy after materialization
|
|
17
|
-
* via _buildCategory recursion with subdirHandler.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // Internal usage - called by slothlet core
|
|
21
|
-
* const api = await create('./api_test', 3, 0);
|
|
22
|
-
* // Returns: { math: [Function: lazyFolder_math], ... } (lazy proxies)
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* // Root-level processing with function exports
|
|
26
|
-
* const api = await create('./api_test');
|
|
27
|
-
* // If root has default function: api becomes that function with properties
|
|
28
|
-
* // Otherwise: api is object with lazy proxy properties
|
|
29
|
-
*/
|
|
30
|
-
export function create(dir: string, maxDepth?: number, currentDepth?: number): Promise<Function | object>;
|
|
31
|
-
//# sourceMappingURL=slothlet_lazy.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slothlet_lazy.d.mts","sourceRoot":"","sources":["../../../../dist/lib/modes/slothlet_lazy.mjs"],"names":[],"mappings":"AAgKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,4BAtBW,MAAM,aACN,MAAM,iBACN,MAAM,GACJ,OAAO,CAAC,WAAS,MAAM,CAAC,CAkKpC"}
|