@cldmv/slothlet 3.3.0 → 3.4.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.
Files changed (139) hide show
  1. package/README.md +9 -10
  2. package/REFERENCE.md +23 -0
  3. package/dist/lib/builders/api-assignment.mjs +1 -589
  4. package/dist/lib/builders/api_builder.mjs +1 -1385
  5. package/dist/lib/builders/builder.mjs +1 -78
  6. package/dist/lib/builders/modes-processor.mjs +1 -1800
  7. package/dist/lib/errors.mjs +9 -211
  8. package/dist/lib/factories/component-base.mjs +1 -80
  9. package/dist/lib/factories/context.mjs +1 -22
  10. package/dist/lib/handlers/api-cache-manager.mjs +1 -200
  11. package/dist/lib/handlers/api-manager.mjs +1 -2536
  12. package/dist/lib/handlers/context-async.mjs +1 -172
  13. package/dist/lib/handlers/context-live.mjs +1 -173
  14. package/dist/lib/handlers/hook-manager.mjs +1 -667
  15. package/dist/lib/handlers/lifecycle-token.mjs +1 -28
  16. package/dist/lib/handlers/lifecycle.mjs +1 -115
  17. package/dist/lib/handlers/materialize-manager.mjs +1 -48
  18. package/dist/lib/handlers/metadata.mjs +1 -501
  19. package/dist/lib/handlers/ownership.mjs +1 -322
  20. package/dist/lib/handlers/permission-manager.mjs +1 -392
  21. package/dist/lib/handlers/unified-wrapper.mjs +1 -3110
  22. package/dist/lib/handlers/version-manager.mjs +1 -885
  23. package/dist/lib/helpers/class-instance-wrapper.mjs +1 -109
  24. package/dist/lib/helpers/config.mjs +1 -439
  25. package/dist/lib/helpers/eventemitter-context.mjs +1 -349
  26. package/dist/lib/helpers/hint-detector.mjs +1 -47
  27. package/dist/lib/helpers/modes-utils.mjs +1 -37
  28. package/dist/lib/helpers/pattern-matcher.mjs +1 -125
  29. package/dist/lib/helpers/resolve-from-caller.mjs +1 -169
  30. package/dist/lib/helpers/sanitize.mjs +1 -340
  31. package/dist/lib/helpers/utilities.mjs +1 -70
  32. package/dist/lib/i18n/languages/de-de.json +1 -0
  33. package/dist/lib/i18n/languages/en-gb.json +1 -0
  34. package/dist/lib/i18n/languages/en-us.json +1 -0
  35. package/dist/lib/i18n/languages/es-es.json +412 -0
  36. package/dist/lib/i18n/languages/es-mx.json +1 -0
  37. package/dist/lib/i18n/languages/fr-fr.json +1 -0
  38. package/dist/lib/i18n/languages/hi-in.json +2 -1
  39. package/dist/lib/i18n/languages/ja-jp.json +1 -0
  40. package/dist/lib/i18n/languages/ko-kr.json +1 -0
  41. package/dist/lib/i18n/languages/pt-br.json +21 -20
  42. package/dist/lib/i18n/languages/ru-ru.json +2 -1
  43. package/dist/lib/i18n/languages/zh-cn.json +6 -5
  44. package/dist/lib/i18n/translations.mjs +1 -126
  45. package/dist/lib/modes/eager.mjs +1 -59
  46. package/dist/lib/modes/lazy.mjs +1 -81
  47. package/dist/lib/processors/flatten.mjs +1 -437
  48. package/dist/lib/processors/loader.mjs +1 -339
  49. package/dist/lib/processors/type-generator.mjs +1 -275
  50. package/dist/lib/processors/typescript.mjs +1 -172
  51. package/dist/lib/runtime/runtime-asynclocalstorage.mjs +1 -113
  52. package/dist/lib/runtime/runtime-livebindings.mjs +1 -78
  53. package/dist/lib/runtime/runtime.mjs +1 -102
  54. package/dist/slothlet.mjs +1 -817
  55. package/package.json +35 -31
  56. package/types/dist/lib/builders/api-assignment.d.mts +3 -92
  57. package/types/dist/lib/builders/api-assignment.d.mts.map +1 -1
  58. package/types/dist/lib/builders/api_builder.d.mts +102 -91
  59. package/types/dist/lib/builders/api_builder.d.mts.map +1 -1
  60. package/types/dist/lib/builders/builder.d.mts +1 -55
  61. package/types/dist/lib/builders/builder.d.mts.map +1 -1
  62. package/types/dist/lib/builders/modes-processor.d.mts +3 -27
  63. package/types/dist/lib/builders/modes-processor.d.mts.map +1 -1
  64. package/types/dist/lib/errors.d.mts +19 -109
  65. package/types/dist/lib/errors.d.mts.map +1 -1
  66. package/types/dist/lib/factories/component-base.d.mts +7 -177
  67. package/types/dist/lib/factories/component-base.d.mts.map +1 -1
  68. package/types/dist/lib/factories/context.d.mts +4 -22
  69. package/types/dist/lib/factories/context.d.mts.map +1 -1
  70. package/types/dist/lib/handlers/api-cache-manager.d.mts +20 -203
  71. package/types/dist/lib/handlers/api-cache-manager.d.mts.map +1 -1
  72. package/types/dist/lib/handlers/api-manager.d.mts +34 -408
  73. package/types/dist/lib/handlers/api-manager.d.mts.map +1 -1
  74. package/types/dist/lib/handlers/context-async.d.mts +23 -61
  75. package/types/dist/lib/handlers/context-async.d.mts.map +1 -1
  76. package/types/dist/lib/handlers/context-live.d.mts +22 -59
  77. package/types/dist/lib/handlers/context-live.d.mts.map +1 -1
  78. package/types/dist/lib/handlers/hook-manager.d.mts +46 -185
  79. package/types/dist/lib/handlers/hook-manager.d.mts.map +1 -1
  80. package/types/dist/lib/handlers/lifecycle-token.d.mts +3 -48
  81. package/types/dist/lib/handlers/lifecycle-token.d.mts.map +1 -1
  82. package/types/dist/lib/handlers/lifecycle.d.mts +5 -82
  83. package/types/dist/lib/handlers/lifecycle.d.mts.map +1 -1
  84. package/types/dist/lib/handlers/materialize-manager.d.mts +8 -70
  85. package/types/dist/lib/handlers/materialize-manager.d.mts.map +1 -1
  86. package/types/dist/lib/handlers/metadata.d.mts +17 -221
  87. package/types/dist/lib/handlers/metadata.d.mts.map +1 -1
  88. package/types/dist/lib/handlers/ownership.d.mts +44 -160
  89. package/types/dist/lib/handlers/ownership.d.mts.map +1 -1
  90. package/types/dist/lib/handlers/permission-manager.d.mts +40 -141
  91. package/types/dist/lib/handlers/permission-manager.d.mts.map +1 -1
  92. package/types/dist/lib/handlers/unified-wrapper.d.mts +26 -239
  93. package/types/dist/lib/handlers/unified-wrapper.d.mts.map +1 -1
  94. package/types/dist/lib/handlers/version-manager.d.mts +28 -225
  95. package/types/dist/lib/handlers/version-manager.d.mts.map +1 -1
  96. package/types/dist/lib/helpers/class-instance-wrapper.d.mts +2 -52
  97. package/types/dist/lib/helpers/class-instance-wrapper.d.mts.map +1 -1
  98. package/types/dist/lib/helpers/config.d.mts +125 -139
  99. package/types/dist/lib/helpers/config.d.mts.map +1 -1
  100. package/types/dist/lib/helpers/eventemitter-context.d.mts +3 -29
  101. package/types/dist/lib/helpers/eventemitter-context.d.mts.map +1 -1
  102. package/types/dist/lib/helpers/hint-detector.d.mts +2 -15
  103. package/types/dist/lib/helpers/hint-detector.d.mts.map +1 -1
  104. package/types/dist/lib/helpers/modes-utils.d.mts +3 -30
  105. package/types/dist/lib/helpers/modes-utils.d.mts.map +1 -1
  106. package/types/dist/lib/helpers/pattern-matcher.d.mts +3 -43
  107. package/types/dist/lib/helpers/pattern-matcher.d.mts.map +1 -1
  108. package/types/dist/lib/helpers/resolve-from-caller.d.mts +3 -27
  109. package/types/dist/lib/helpers/resolve-from-caller.d.mts.map +1 -1
  110. package/types/dist/lib/helpers/sanitize.d.mts +4 -92
  111. package/types/dist/lib/helpers/sanitize.d.mts.map +1 -1
  112. package/types/dist/lib/helpers/utilities.d.mts +4 -52
  113. package/types/dist/lib/helpers/utilities.d.mts.map +1 -1
  114. package/types/dist/lib/i18n/translations.d.mts +4 -37
  115. package/types/dist/lib/i18n/translations.d.mts.map +1 -1
  116. package/types/dist/lib/modes/eager.d.mts +8 -30
  117. package/types/dist/lib/modes/eager.d.mts.map +1 -1
  118. package/types/dist/lib/modes/lazy.d.mts +10 -43
  119. package/types/dist/lib/modes/lazy.d.mts.map +1 -1
  120. package/types/dist/lib/processors/flatten.d.mts +56 -107
  121. package/types/dist/lib/processors/flatten.d.mts.map +1 -1
  122. package/types/dist/lib/processors/loader.d.mts +6 -41
  123. package/types/dist/lib/processors/loader.d.mts.map +1 -1
  124. package/types/dist/lib/processors/type-generator.d.mts +2 -16
  125. package/types/dist/lib/processors/type-generator.d.mts.map +1 -1
  126. package/types/dist/lib/processors/typescript.d.mts +6 -53
  127. package/types/dist/lib/processors/typescript.d.mts.map +1 -1
  128. package/types/dist/lib/runtime/runtime-asynclocalstorage.d.mts +3 -71
  129. package/types/dist/lib/runtime/runtime-asynclocalstorage.d.mts.map +1 -1
  130. package/types/dist/lib/runtime/runtime-livebindings.d.mts +2 -37
  131. package/types/dist/lib/runtime/runtime-livebindings.d.mts.map +1 -1
  132. package/types/dist/lib/runtime/runtime.d.mts +3 -39
  133. package/types/dist/lib/runtime/runtime.d.mts.map +1 -1
  134. package/types/dist/slothlet.d.mts +3 -249
  135. package/types/dist/slothlet.d.mts.map +1 -1
  136. package/types/index.d.mts +36 -16
  137. package/types/index.d.mts.map +1 -0
  138. package/AGENT-USAGE.md +0 -736
  139. package/docs/API-RULES.md +0 -712
@@ -1,57 +1,9 @@
1
- /**
2
- * General utility functions
3
- * @class Utilities
4
- * @extends ComponentBase
5
- * @package
6
- */
7
1
  export class Utilities extends ComponentBase {
8
2
  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;
3
+ isPlainObject(obj: any): boolean;
4
+ deepMerge(target: any, source: any): any;
5
+ deepClone(obj: any): any;
6
+ generateId(): string;
55
7
  }
56
8
  import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
57
9
  //# sourceMappingURL=utilities.d.mts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"utilities.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/utilities.mjs"],"names":[],"mappings":"AAAoE;IAAsC,gCAAoC;IAAA,iCAA0J;IAAA,yCAAmX;IAAA,yBAA+Y;IAAA,qBAAsF;CAAC;8BAAxmC,0CAA0C"}
@@ -1,39 +1,6 @@
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
1
  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;
2
+ export function initI18n(options?: {}): void;
3
+ export function setLanguage(lang: any): void;
4
+ export function t(errorCode: any, params?: {}): any;
5
+ export function translate(errorCode: any, params?: {}): any;
39
6
  //# sourceMappingURL=translations.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.mts","sourceRoot":"","sources":["../../../../dist/lib/i18n/translations.mjs"],"names":[],"mappings":"AAuFA;;;;;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"}
1
+ {"version":3,"file":"translations.d.mts","sourceRoot":"","sources":["../../../../dist/lib/i18n/translations.mjs"],"names":[],"mappings":"AAA2zD,sCAA8C;AAAmc,6CAAgU;AAA/rC,6CAA8Y;AAA8C,oDAAmc;AAAnc,4DAAmc"}
@@ -1,35 +1,13 @@
1
- /**
2
- * Eager mode component - builds APIs by loading all modules immediately.
3
- * @class EagerMode
4
- * @extends ComponentBase
5
- * @package
6
- */
7
1
  export class EagerMode extends ComponentBase {
8
2
  static slothletProperty: string;
9
- /**
10
- * Build API in eager mode (load all modules immediately).
11
- * @param {Object} options - Build options
12
- * @param {string} options.dir - Directory path to load from
13
- * @param {string} [options.apiPathPrefix=""] - Prefix for API paths
14
- * @param {string} [options.collisionContext="initial"] - Collision context
15
- * @param {string} [options.moduleID] - Module ID
16
- * @param {number} [options.apiDepth=Infinity] - Maximum directory depth
17
- * @param {string|null} [options.cacheBust=null] - Cache-busting value
18
- * @param {Function|null} [options.fileFilter=null] - Optional filter (fileName) => boolean
19
- * @returns {Promise<Object>} Built API object
20
- * @public
21
- *
22
- * @example
23
- * const api = await slothlet.modes.eager.buildAPI({ dir: "./api", moduleID: "base" });
24
- */
25
- public buildAPI({ dir, apiPathPrefix, collisionContext, moduleID, apiDepth, cacheBust, fileFilter }: {
26
- dir: string;
27
- apiPathPrefix?: string;
28
- collisionContext?: string;
29
- moduleID?: string;
30
- apiDepth?: number;
31
- cacheBust?: string | null;
32
- fileFilter?: Function | null;
3
+ buildAPI({ dir, apiPathPrefix, collisionContext, moduleID, apiDepth, cacheBust, fileFilter }: {
4
+ dir: any;
5
+ apiPathPrefix?: string | undefined;
6
+ collisionContext?: string | undefined;
7
+ moduleID: any;
8
+ apiDepth?: number | undefined;
9
+ cacheBust?: null | undefined;
10
+ fileFilter?: null | undefined;
33
11
  }): Promise<any>;
34
12
  }
35
13
  import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
@@ -1 +1 @@
1
- {"version":3,"file":"eager.d.mts","sourceRoot":"","sources":["../../../../dist/lib/modes/eager.mjs"],"names":[],"mappings":"AAoBA;;;;;GAKG;AACH;IACC,gCAAkC;IAWlC;;;;;;;;;;;;;;;OAeG;IACH,qGAbG;QAAwB,GAAG,EAAnB,MAAM;QACW,aAAa,GAA9B,MAAM;QACW,gBAAgB,GAAjC,MAAM;QACW,QAAQ,GAAzB,MAAM;QACW,QAAQ,GAAzB,MAAM;QACgB,SAAS,GAA/B,MAAM,GAAC,IAAI;QACa,UAAU,GAAlC,WAAS,IAAI;KACrB,GAAU,OAAO,KAAQ,CAgD3B;CACD;8BA/E6B,0CAA0C"}
1
+ {"version":3,"file":"eager.d.mts","sourceRoot":"","sources":["../../../../dist/lib/modes/eager.mjs"],"names":[],"mappings":"AAAoE;IAAsC,gCAAgC;IAAsC;;;;;;;;qBAAkpB;CAAC;8BAA1yB,0CAA0C"}
@@ -1,48 +1,15 @@
1
- /**
2
- * Lazy mode component - builds APIs with deferred (on-demand) loading.
3
- * @class LazyMode
4
- * @extends ComponentBase
5
- * @package
6
- */
7
1
  export class LazyMode extends ComponentBase {
8
2
  static slothletProperty: string;
9
- /**
10
- * Create a named async materialization function for lazy subdirectories.
11
- * @param {string} apiPath - API path to derive the function name from.
12
- * @param {Function} handler - Async handler that performs materialization.
13
- * @returns {Function} Named async materialization function.
14
- * @public
15
- *
16
- * @example
17
- * const fn = lazyMode.createNamedMaterializeFunc('api.math', async () => ({ add: (a,b) => a+b }));
18
- */
19
- public createNamedMaterializeFunc(apiPath: string, handler: Function): Function;
20
- /**
21
- * Build API in lazy mode (proxy-based deferred loading).
22
- * @param {Object} options - Build options
23
- * @param {string} options.dir - Directory to build from
24
- * @param {string} [options.apiPathPrefix=""] - Prefix for API paths
25
- * @param {string} [options.collisionContext="initial"] - Collision context
26
- * @param {string|null} [options.collisionMode=null] - Collision mode override from api.add()
27
- * @param {string} [options.moduleID] - Module ID
28
- * @param {number} [options.apiDepth=Infinity] - Maximum directory depth
29
- * @param {string|null} [options.cacheBust=null] - Cache-busting value
30
- * @param {Function|null} [options.fileFilter=null] - Optional filter (fileName) => boolean
31
- * @returns {Promise<Object>} Built API object with lazy proxies
32
- * @public
33
- *
34
- * @example
35
- * const api = await slothlet.modes.lazy.buildAPI({ dir: "./api", moduleID: "base" });
36
- */
37
- public buildAPI({ dir, apiPathPrefix, collisionContext, collisionMode, moduleID, apiDepth, cacheBust, fileFilter }: {
38
- dir: string;
39
- apiPathPrefix?: string;
40
- collisionContext?: string;
41
- collisionMode?: string | null;
42
- moduleID?: string;
43
- apiDepth?: number;
44
- cacheBust?: string | null;
45
- fileFilter?: Function | null;
3
+ createNamedMaterializeFunc(apiPath: any, handler: any): (...args: any[]) => Promise<any>;
4
+ buildAPI({ dir, apiPathPrefix, collisionContext, collisionMode, moduleID, apiDepth, cacheBust, fileFilter }: {
5
+ dir: any;
6
+ apiPathPrefix?: string | undefined;
7
+ collisionContext?: string | undefined;
8
+ collisionMode?: null | undefined;
9
+ moduleID: any;
10
+ apiDepth?: number | undefined;
11
+ cacheBust?: null | undefined;
12
+ fileFilter?: null | undefined;
46
13
  }): Promise<any>;
47
14
  }
48
15
  import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
@@ -1 +1 @@
1
- {"version":3,"file":"lazy.d.mts","sourceRoot":"","sources":["../../../../dist/lib/modes/lazy.mjs"],"names":[],"mappings":"AAoBA;;;;;GAKG;AACH;IACC,gCAAiC;IAWjC;;;;;;;;;OASG;IACH,2CARW,MAAM,+BAmBhB;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,oHAdG;QAAwB,GAAG,EAAnB,MAAM;QACW,aAAa,GAA9B,MAAM;QACW,gBAAgB,GAAjC,MAAM;QACgB,aAAa,GAAnC,MAAM,GAAC,IAAI;QACM,QAAQ,GAAzB,MAAM;QACW,QAAQ,GAAzB,MAAM;QACgB,SAAS,GAA/B,MAAM,GAAC,IAAI;QACa,UAAU,GAAlC,WAAS,IAAI;KACrB,GAAU,OAAO,KAAQ,CAwD3B;CACD;8BA/G6B,0CAA0C"}
1
+ {"version":3,"file":"lazy.d.mts","sourceRoot":"","sources":["../../../../dist/lib/modes/lazy.mjs"],"names":[],"mappings":"AAAoE;IAAqC,gCAA+B;IAAsC,yFAAiV;IAAA;;;;;;;;;qBAAqyB;CAAC;8BAA5wC,0CAA0C"}
@@ -1,113 +1,62 @@
1
- /**
2
- * Flattening decision processor
3
- * @class Flatten
4
- * @extends ComponentBase
5
- * @package
6
- */
7
1
  export class Flatten extends ComponentBase {
8
2
  static slothletProperty: string;
9
- /**
10
- * Core flattening decision function.
11
- * Implements conditions C01-C07 from getFlatteningDecision().
12
- * @param {object} options - Decision options
13
- * @param {object} options.mod - Module exports
14
- * @param {string} options.moduleName - Sanitized module name
15
- * @param {string} options.categoryName - Category/folder name
16
- * @param {object} options.analysis - Export analysis
17
- * @param {boolean} options.hasMultipleDefaults - Multiple defaults in folder
18
- * @param {array} options.moduleKeys - Keys from module
19
- * @param {function} options.t - Translation function
20
- * @returns {Promise<object>} Flattening decision
21
- * @public
22
- */
23
- public getFlatteningDecision(options: {
24
- mod: object;
25
- moduleName: string;
26
- categoryName: string;
27
- analysis: object;
28
- hasMultipleDefaults: boolean;
29
- moduleKeys: any[];
30
- t: Function;
31
- }): Promise<object>;
32
- /**
33
- * Build module content for API assignment.
34
- *
35
- * Canonical implementation of the C08-C09b content-building rules, including
36
- * AddApi detection and collision handling. Previously this logic was inlined
37
- * inside modes-processor.mjs; it now lives here so the processor stays focused
38
- * on wrapping and assignment concerns only.
39
- *
40
- * Collision config, modesUtils helpers, and SlothletWarning are accessed
41
- * directly through {@link this.slothlet} / {@link this.slothlet.config} — no caller
42
- * plumbing required.
43
- *
44
- * @param {object} options - Processing options.
45
- * @param {object} options.mod - Module exports.
46
- * @param {object} options.decision - Flattening decision from getFlatteningDecision.
47
- * @param {string} options.moduleName - Sanitized module name (used for C08 auto-flatten key lookup).
48
- * @param {string} options.propertyName - Resolved preferred name (decision.preferredName || moduleName).
49
- * @param {string[]} options.moduleKeys - Named export keys (excluding "default").
50
- * @param {object} options.analysis - { hasDefault, hasNamed, defaultExportType }.
51
- * @param {object} [options.file=null] - File descriptor for AddApi detection via file.name / file.fullName.
52
- * @param {string} [options.collisionContext="initial"] - Collision context ("initial" | "api").
53
- * @param {string} [options.apiPathPrefix=""] - API path prefix for collision error messages.
54
- * @returns {{ moduleContent: object|Function }} Built module content ready for wrapping/assignment.
55
- * @public
56
- */
57
- public processModuleForAPI(options: {
58
- mod: object;
59
- decision: object;
60
- moduleName: string;
61
- propertyName: string;
62
- moduleKeys: string[];
63
- analysis: object;
64
- file?: object;
65
- collisionContext?: string;
66
- apiPathPrefix?: string;
67
- }): {
68
- moduleContent: object | Function;
3
+ getFlatteningDecision(options: any): Promise<{
4
+ preserveAsNamespace: boolean;
5
+ reason: any;
6
+ flattenToRoot?: undefined;
7
+ } | {
8
+ flattenToRoot: boolean;
9
+ reason: any;
10
+ preserveAsNamespace?: undefined;
11
+ } | {
12
+ flattenToCategory: boolean;
13
+ flattenType: string;
14
+ reason: any;
15
+ useAutoFlattening?: undefined;
16
+ preserveAsNamespace?: undefined;
17
+ preferredName?: undefined;
18
+ } | {
19
+ useAutoFlattening: boolean;
20
+ reason: any;
21
+ flattenToCategory?: undefined;
22
+ flattenType?: undefined;
23
+ preserveAsNamespace?: undefined;
24
+ preferredName?: undefined;
25
+ } | {
26
+ flattenToCategory: boolean;
27
+ reason: any;
28
+ flattenType?: undefined;
29
+ useAutoFlattening?: undefined;
30
+ preserveAsNamespace?: undefined;
31
+ preferredName?: undefined;
32
+ } | {
33
+ preserveAsNamespace: boolean;
34
+ preferredName: any;
35
+ reason: any;
36
+ flattenToCategory?: undefined;
37
+ flattenType?: undefined;
38
+ useAutoFlattening?: undefined;
39
+ }>;
40
+ processModuleForAPI(options: any): {
41
+ moduleContent: any;
69
42
  };
70
- /**
71
- * Build category-level flattening decisions.
72
- * Implements conditions C10-C33 from buildCategoryDecisions().
73
- * @param {object} options - Category options
74
- * @param {string} options.categoryName - Category name
75
- * @param {object} options.mod - Module exports
76
- * @param {string} options.moduleName - Module name
77
- * @param {string} options.fileBaseName - File base name
78
- * @param {object} options.analysis - Export analysis
79
- * @param {array} options.moduleKeys - Module keys
80
- * @param {number} options.currentDepth - Current depth
81
- * @param {array} options.moduleFiles - Files in category
82
- * @param {function} options.t - Translation function
83
- * @returns {Promise<object>} Category decision
84
- * @public
85
- */
86
- public buildCategoryDecisions(options: {
87
- categoryName: string;
88
- mod: object;
89
- moduleName: string;
90
- fileBaseName: string;
91
- analysis: object;
92
- moduleKeys: any[];
93
- currentDepth: number;
94
- moduleFiles: any[];
95
- t: Function;
96
- }): Promise<object>;
97
- /**
98
- * Decide whether a named export should be attached to a callable default export.
99
- *
100
- * Returns false when the named export is the same reference as the default (re-export
101
- * pattern), or when the export key matches the function name (self-referential export).
102
- *
103
- * @param {string} key - Named export key.
104
- * @param {unknown} value - Named export value.
105
- * @param {Function} defaultFunc - Wrapped callable default export.
106
- * @param {Function} originalDefault - Original default export.
107
- * @returns {boolean} True if the export should be attached.
108
- * @public
109
- */
110
- public shouldAttachNamedExport(key: string, value: unknown, defaultFunc: Function, originalDefault: Function): boolean;
43
+ buildCategoryDecisions(options: any): Promise<{
44
+ shouldFlatten: boolean;
45
+ flattenType: string;
46
+ reason: any;
47
+ preferredName?: undefined;
48
+ } | {
49
+ shouldFlatten: boolean;
50
+ flattenType: string;
51
+ preferredName: any;
52
+ reason: any;
53
+ } | {
54
+ shouldFlatten: boolean;
55
+ preferredName: any;
56
+ reason: any;
57
+ flattenType?: undefined;
58
+ }>;
59
+ shouldAttachNamedExport(key: any, value: any, defaultFunc: any, originalDefault: any): boolean;
111
60
  #private;
112
61
  }
113
62
  import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
@@ -1 +1 @@
1
- {"version":3,"file":"flatten.d.mts","sourceRoot":"","sources":["../../../../dist/lib/processors/flatten.mjs"],"names":[],"mappings":"AA8BA;;;;;GAKG;AACH;IACC,gCAAoC;IAgEpC;;;;;;;;;;;;;OAaG;IACH,sCAVG;QAAwB,GAAG,EAAnB,MAAM;QACU,UAAU,EAA1B,MAAM;QACU,YAAY,EAA5B,MAAM;QACU,QAAQ,EAAxB,MAAM;QACW,mBAAmB,EAApC,OAAO;QACQ,UAAU;QACP,CAAC;KAC3B,GAAU,OAAO,CAAC,MAAM,CAAC,CAiG3B;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,oCAZG;QAA0B,GAAG,EAArB,MAAM;QACY,QAAQ,EAA1B,MAAM;QACY,UAAU,EAA5B,MAAM;QACY,YAAY,EAA9B,MAAM;QACY,UAAU,EAA5B,MAAM,EAAE;QACU,QAAQ,EAA1B,MAAM;QACa,IAAI,GAAvB,MAAM;QACa,gBAAgB,GAAnC,MAAM;QACa,aAAa,GAAhC,MAAM;KACd,GAAU;QAAE,aAAa,EAAE,MAAM,WAAS,CAAA;KAAE,CAqI9C;IAED;;;;;;;;;;;;;;;OAeG;IACH,uCAZG;QAAwB,YAAY,EAA5B,MAAM;QACU,GAAG,EAAnB,MAAM;QACU,UAAU,EAA1B,MAAM;QACU,YAAY,EAA5B,MAAM;QACU,QAAQ,EAAxB,MAAM;QACS,UAAU;QACT,YAAY,EAA5B,MAAM;QACS,WAAW;QACR,CAAC;KAC3B,GAAU,OAAO,CAAC,MAAM,CAAC,CAiJ3B;IAED;;;;;;;;;;;;OAYG;IACH,oCAPW,MAAM,SACN,OAAO,qDAGL,OAAO,CAiBnB;;CACD;8BAhhB6B,0CAA0C"}
1
+ {"version":3,"file":"flatten.d.mts","sourceRoot":"","sources":["../../../../dist/lib/processors/flatten.mjs"],"names":[],"mappings":"AAAoE;IAAoC,gCAAkC;IAAqjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAA8pE;IAAA;;MAA+yF;IAAA;;;;;;;;;;;;;;;OAAk7G;IAAA,+FAA0U;;CAAC;8BAAh3S,0CAA0C"}
@@ -1,46 +1,11 @@
1
- /**
2
- * Loader component for module loading, directory scanning, and API merging
3
- * @class Loader
4
- * @extends ComponentBase
5
- * @package
6
- */
7
1
  export class Loader extends ComponentBase {
8
2
  static slothletProperty: string;
9
- constructor(slothlet: any);
10
- /**
11
- * Load a single module
12
- * @param {string} filePath - Path to module file
13
- * @param {string} [instanceID] - Slothlet instance ID for cache busting
14
- * @param {string} [moduleID] - Module ID for additional cache busting (used in api.slothlet.api.add)
15
- * @param {number|null} [cacheBust=null] - Timestamp for reload cache busting (forces fresh import)
16
- * @returns {Promise<Object>} Loaded module
17
- * @public
18
- */
19
- public loadModule(filePath: string, instanceID?: string, moduleID?: string, cacheBust?: number | null): Promise<any>;
20
- /**
21
- * Scan directory for module files
22
- * @param {string} dir - Directory to scan
23
- * @param {Object} [options={}] - Scan options
24
- * @param {boolean} [options.isRootScan=true] - Whether this is the root directory scan (shows empty dir warning)
25
- * @param {number} [options.currentDepth=0] - Current traversal depth
26
- * @param {number} [options.maxDepth=Infinity] - Maximum traversal depth
27
- * @param {Function|null} [options.fileFilter=null] - Optional filter function (fileName) => boolean to load specific files only
28
- * @returns {Promise<Object>} Directory structure
29
- * @public
30
- */
31
- public scanDirectory(dir: string, options?: {
32
- isRootScan?: boolean;
33
- currentDepth?: number;
34
- maxDepth?: number;
35
- fileFilter?: Function | null;
36
- }): Promise<any>;
37
- /**
38
- * Extract exports from module
39
- * @param {Object} module - Loaded module
40
- * @returns {Object} Extracted exports
41
- * @public
42
- */
43
- public extractExports(module: any): any;
3
+ loadModule(filePath: any, instanceID: any, moduleID: any, cacheBust?: null): Promise<any>;
4
+ scanDirectory(dir: any, options?: {}): Promise<{
5
+ files: never[];
6
+ directories: never[];
7
+ }>;
8
+ extractExports(module: any): {};
44
9
  #private;
45
10
  }
46
11
  import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.mts","sourceRoot":"","sources":["../../../../dist/lib/processors/loader.mjs"],"names":[],"mappings":"AA8BA;;;;;GAKG;AACH;IACC,gCAAmC;IAEnC,2BAEC;IAED;;;;;;;;OAQG;IACH,4BAPW,MAAM,eACN,MAAM,aACN,MAAM,cACN,MAAM,GAAC,IAAI,GACT,OAAO,KAAQ,CAwK3B;IAuCD;;;;;;;;;;OAUG;IACH,0BATW,MAAM,YAEd;QAA0B,UAAU,GAA5B,OAAO;QACU,YAAY,GAA7B,MAAM;QACW,QAAQ,GAAzB,MAAM;QACkB,UAAU,GAAlC,WAAS,IAAI;KACrB,GAAU,OAAO,KAAQ,CA0F3B;IAED;;;;;OAKG;IACH,wCAoCC;;CACD;8BAnX6B,0CAA0C"}
1
+ {"version":3,"file":"loader.d.mts","sourceRoot":"","sources":["../../../../dist/lib/processors/loader.mjs"],"names":[],"mappings":"AAA+O;IAAmC,gCAAiC;IAAsC,0FAA2nG;IAA4Y;;;OAA+7C;IAAA,gCAAipB;;CAAC;8BAA7uL,0CAA0C"}
@@ -1,19 +1,5 @@
1
- /**
2
- * Generate TypeScript declaration file for a Slothlet API
3
- * @param {object} api - The loaded Slothlet API
4
- * @param {object} options - Generation options
5
- * @param {string} options.output - Output file path for .d.ts
6
- * @param {string} options.interfaceName - Name of the interface to generate
7
- * @param {boolean} [options.includeDocumentation=true] - Include JSDoc comments
8
- * @returns {Promise<{output: string, filePath: string}>} Generated declaration and output path
9
- * @public
10
- */
11
- export function generateTypes(api: object, options: {
1
+ export function generateTypes(api: any, options: any): Promise<{
12
2
  output: string;
13
- interfaceName: string;
14
- includeDocumentation?: boolean;
15
- }): Promise<{
16
- output: string;
17
- filePath: string;
3
+ filePath: any;
18
4
  }>;
19
5
  //# sourceMappingURL=type-generator.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-generator.d.mts","sourceRoot":"","sources":["../../../../dist/lib/processors/type-generator.mjs"],"names":[],"mappings":"AA8CA;;;;;;;;;GASG;AACH,mCARW,MAAM,WAEd;IAAwB,MAAM,EAAtB,MAAM;IACU,aAAa,EAA7B,MAAM;IACY,oBAAoB,GAAtC,OAAO;CACf,GAAU,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAAC,CAqDvD"}
1
+ {"version":3,"file":"type-generator.d.mts","sourceRoot":"","sources":["../../../../dist/lib/processors/type-generator.mjs"],"names":[],"mappings":"AAA+V;;;GAAwiC"}
@@ -1,55 +1,8 @@
1
- /**
2
- * Transform TypeScript code to JavaScript using esbuild
3
- * @param {string} filePath - Path to the TypeScript file
4
- * @param {object} [options={}] - esbuild transform options
5
- * @param {string} [options.target] - ECMAScript target version (default: "es2020")
6
- * @param {string} [options.format] - Module format (default: "esm")
7
- * @param {boolean} [options.sourcemap] - Generate source maps (default: false)
8
- * @returns {Promise<string>} Transformed JavaScript code
9
- * @throws {SlothletError} If transformation fails
10
- * @public
11
- */
12
- export function transformTypeScript(filePath: string, options?: {
13
- target?: string;
14
- format?: string;
15
- sourcemap?: boolean;
16
- }): Promise<string>;
17
- /**
18
- * Create a data URL for dynamic import with cache busting
19
- * @param {string} code - JavaScript code to encode
20
- * @returns {string} Data URL suitable for dynamic import
21
- * @public
22
- */
23
- export function createDataUrl(code: string): string;
24
- /**
25
- * Transform TypeScript code to JavaScript using tsc with type checking
26
- * @param {string} filePath - Path to the TypeScript file
27
- * @param {object} [options={}] - TypeScript compiler options
28
- * @param {string} [options.target] - ECMAScript target version (default: "ES2020")
29
- * @param {string} [options.module] - Module format (default: "ESNext")
30
- * @param {boolean} [options.strict] - Enable strict type checking (default: true)
31
- * @param {boolean} [options.skipTypeCheck] - Skip type checking and only transform (default: false)
32
- * @param {string} [options.typeDefinitionPath] - Path to .d.ts file for type checking
33
- * @returns {Promise<{code: string, diagnostics: object[]}>} Transformed code and type diagnostics
34
- * @throws {SlothletError} If transformation fails
35
- * @public
36
- */
37
- export function transformTypeScriptStrict(filePath: string, options?: {
38
- target?: string;
39
- module?: string;
40
- strict?: boolean;
41
- skipTypeCheck?: boolean;
42
- typeDefinitionPath?: string;
43
- }): Promise<{
44
- code: string;
45
- diagnostics: object[];
1
+ export function createDataUrl(code: any): string;
2
+ export function formatDiagnostics(diagnostics: any, ts: any): any;
3
+ export function transformTypeScript(filePath: any, options?: {}): Promise<any>;
4
+ export function transformTypeScriptStrict(filePath: any, options?: {}): Promise<{
5
+ code: any;
6
+ diagnostics: any[];
46
7
  }>;
47
- /**
48
- * Format TypeScript diagnostics into readable error messages
49
- * @param {object[]} diagnostics - TypeScript diagnostic objects
50
- * @param {object} ts - TypeScript module instance
51
- * @returns {string[]} Array of formatted error messages
52
- * @private
53
- */
54
- export function formatDiagnostics(diagnostics: object[], ts: object): string[];
55
8
  //# sourceMappingURL=typescript.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.d.mts","sourceRoot":"","sources":["../../../../dist/lib/processors/typescript.mjs"],"names":[],"mappings":"AAqEA;;;;;;;;;;GAUG;AACH,8CATW,MAAM,YAEd;IAAyB,MAAM,GAAvB,MAAM;IACW,MAAM,GAAvB,MAAM;IACY,SAAS,GAA3B,OAAO;CACf,GAAU,OAAO,CAAC,MAAM,CAAC,CAiB3B;AAED;;;;;GAKG;AACH,oCAJW,MAAM,GACJ,MAAM,CAQlB;AAED;;;;;;;;;;;;GAYG;AACH,oDAXW,MAAM,YAEd;IAAyB,MAAM,GAAvB,MAAM;IACW,MAAM,GAAvB,MAAM;IACY,MAAM,GAAxB,OAAO;IACW,aAAa,GAA/B,OAAO;IACU,kBAAkB,GAAnC,MAAM;CACd,GAAU,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAC,CAAC,CA6F1D;AAED;;;;;;GAMG;AACH,+CALW,MAAM,EAAE,MACR,MAAM,GACJ,MAAM,EAAE,CAapB"}
1
+ {"version":3,"file":"typescript.d.mts","sourceRoot":"","sources":["../../../../dist/lib/processors/typescript.mjs"],"names":[],"mappings":"AAA83B,iDAAoK;AAAm6D,kEAAkZ;AAArxF,+EAA4T;AAAoK;;;GAAm6D"}
@@ -1,72 +1,4 @@
1
- /**
2
- * Live binding to the current API (self-reference)
3
- * @type {Proxy}
4
- * @public
5
- *
6
- * @description
7
- * A proxy that provides access to the full API object within the current context.
8
- * Automatically resolves to the correct instance's API in AsyncLocalStorage context.
9
- *
10
- * @example
11
- * import { self } from "@cldmv/slothlet/runtime/async";
12
- *
13
- * export function callOtherFunction() {
14
- * // Call another function in the same API
15
- * return self.otherFunction();
16
- * }
17
- */
18
- export const self: ProxyConstructor;
19
- /**
20
- * User-provided context object
21
- * @type {Proxy}
22
- * @public
23
- *
24
- * @description
25
- * A proxy that provides access to user-provided context data (e.g., request data, user info).
26
- * Can be set via `slothlet.run()` or `slothlet.scope()`.
27
- *
28
- * @example
29
- * import { context } from "@cldmv/slothlet/runtime/async";
30
- *
31
- * export function getUserInfo() {
32
- * // Access user-provided context
33
- * return {
34
- * userId: context.userId,
35
- * userName: context.userName
36
- * };
37
- * }
38
- */
39
- export const context: ProxyConstructor;
40
- /**
41
- * Reference to initialization reference object
42
- * @type {Proxy}
43
- * @public
44
- *
45
- * @description
46
- * The reference object is merged directly into the API at initialization using the add API system.
47
- * It is NOT available as a runtime export. Access it directly from the API or via api.slothlet.diag.reference().
48
- *
49
- * @example
50
- * // Reference merged into API - access directly:
51
- * export function useReferenceData() {
52
- * return self.myData; // if reference had myData property
53
- * }
54
- */
55
- /**
56
- * Current instance ID
57
- * @type {Proxy}
58
- * @public
59
- *
60
- * @description
61
- * A proxy that provides access to the current slothlet instance ID.
62
- * Useful for debugging and tracking which instance is handling a request.
63
- *
64
- * @example
65
- * import { instanceID } from "@cldmv/slothlet/runtime/async";
66
- *
67
- * export function getInstanceInfo() {
68
- * return { instanceID };
69
- * }
70
- */
71
- export const instanceID: ProxyConstructor;
1
+ export const context: {};
2
+ export const instanceID: {};
3
+ export const self: {};
72
4
  //# sourceMappingURL=runtime-asynclocalstorage.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-asynclocalstorage.d.mts","sourceRoot":"","sources":["../../../../dist/lib/runtime/runtime-asynclocalstorage.mjs"],"names":[],"mappings":"AA4DA;;;;;;;;;;;;;;;;GAgBG;AACH,oCAgCE;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,uCAkCE;AAEF;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,0CAqBE"}
1
+ {"version":3,"file":"runtime-asynclocalstorage.d.mts","sourceRoot":"","sources":["../../../../dist/lib/runtime/runtime-asynclocalstorage.mjs"],"names":[],"mappings":"AAA2xB,yBAAmrB;AAAA,4BAA6V;AAA3mD,sBAA2lB"}