@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
package/index.cjs
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* @Project: @cldmv/slothlet
|
|
3
3
|
* @Filename: /index.cjs
|
|
4
4
|
* @Date: 2025-11-09 11:15:17 -08:00 (1762715717)
|
|
5
|
-
* @Author: Nate
|
|
5
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
6
6
|
* @Email: <Shinrai@users.noreply.github.com>
|
|
7
7
|
* -----
|
|
8
|
-
* @Last modified by: Nate
|
|
9
|
-
* @Last modified time:
|
|
8
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
9
|
+
* @Last modified time: 2026-03-01 20:21:36 -08:00 (1772425296)
|
|
10
10
|
* -----
|
|
11
|
-
* @Copyright: Copyright (c) 2013-
|
|
11
|
+
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
/**
|
package/index.mjs
CHANGED
|
@@ -1,43 +1,95 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* @Project: @cldmv/slothlet
|
|
3
|
+
* @Filename: /index.mjs
|
|
4
|
+
* @Date: 2025-09-09T08:06:19-07:00 (1757430379)
|
|
5
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
6
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
7
|
+
* -----
|
|
8
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
9
|
+
* @Last modified time: 2026-03-01 20:21:36 -08:00 (1772425296)
|
|
10
|
+
* -----
|
|
11
|
+
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
4
12
|
*/
|
|
5
13
|
|
|
6
14
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @
|
|
9
|
-
* @param {string} runtime - Input runtime type (various formats accepted)
|
|
10
|
-
* @returns {string} Normalized runtime type ("async" or "live")
|
|
11
|
-
* @internal
|
|
12
|
-
* @private
|
|
15
|
+
* @fileoverview ESM entry point for @cldmv/slothlet with automatic source/dist detection and live-binding context.
|
|
16
|
+
* @module @cldmv/slothlet
|
|
13
17
|
*/
|
|
14
|
-
function normalizeRuntimeType(runtime) {
|
|
15
|
-
if (!runtime || typeof runtime !== "string") {
|
|
16
|
-
return "async"; // Default to AsyncLocalStorage
|
|
17
|
-
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
// Custom uncaught exception handler for SlothletError
|
|
20
|
+
process.on("uncaughtException", (error) => {
|
|
21
|
+
if (error.name === "SlothletError") {
|
|
22
|
+
console.error("\n================================================================================");
|
|
23
|
+
console.error(`ERROR [${error.code}]: ${error.message}`);
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
// Extract and show file/line from original error stack if available
|
|
26
|
+
const stackToUse = error.originalError?.stack || error.stack;
|
|
27
|
+
if (stackToUse) {
|
|
28
|
+
const stackLines = stackToUse.split("\n");
|
|
29
|
+
// For import errors, try to extract from the error message first (more accurate)
|
|
30
|
+
if (
|
|
31
|
+
error.originalError?.message?.includes("does not provide an export") ||
|
|
32
|
+
error.originalError?.message?.includes("Cannot find module")
|
|
33
|
+
) {
|
|
34
|
+
// Extract file path from context (modulePath is the file that failed to import)
|
|
35
|
+
const failedFile = error.context?.modulePath;
|
|
36
|
+
if (failedFile) {
|
|
37
|
+
console.error(`\n📍 Location: ${failedFile} (import statement)`);
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
// Otherwise extract from stack trace
|
|
41
|
+
const firstStackLine = stackLines[1]; // First line after error message
|
|
42
|
+
if (firstStackLine) {
|
|
43
|
+
// Extract file:line info from stack trace (format: "at function (file:line:col)")
|
|
44
|
+
const match = firstStackLine.match(/\((.+?):(\d+):(\d+)\)/) || firstStackLine.match(/at (.+?):(\d+):(\d+)/);
|
|
45
|
+
if (match) {
|
|
46
|
+
console.error(`\n📍 Location: ${match[1]}:${match[2]}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (error.hint) {
|
|
53
|
+
console.error("\n💡 Hint:");
|
|
54
|
+
console.error(` ${error.hint}`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Show minimal context (filter out error/hint/originalError which are already shown)
|
|
58
|
+
const contextKeys = Object.keys(error.context || {}).filter((k) => k !== "error" && k !== "hint" && k !== "originalError");
|
|
59
|
+
if (contextKeys.length > 0) {
|
|
60
|
+
console.error("\nDetails:");
|
|
61
|
+
for (const key of contextKeys) {
|
|
62
|
+
const value = error.context[key];
|
|
63
|
+
const displayValue = typeof value === "string" ? value : JSON.stringify(value, null, 2);
|
|
64
|
+
console.error(` ${key}: ${displayValue}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
25
67
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
68
|
+
// Show clean stack trace (prefer original error's stack)
|
|
69
|
+
const stackForDisplay = error.originalError?.stack || error.stack;
|
|
70
|
+
if (stackForDisplay) {
|
|
71
|
+
console.error("\nStack Trace:");
|
|
72
|
+
const stackLines = stackForDisplay.split("\n").slice(1); // Skip first line (error message)
|
|
73
|
+
for (const line of stackLines) {
|
|
74
|
+
console.error(` ${line.trim()}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
console.error("================================================================================\n");
|
|
79
|
+
process.exit(1);
|
|
29
80
|
}
|
|
30
81
|
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
}
|
|
82
|
+
// Re-throw other errors to let Node.js handle them
|
|
83
|
+
throw error;
|
|
84
|
+
});
|
|
34
85
|
|
|
35
86
|
// Development environment check (must happen before slothlet imports)
|
|
36
|
-
(async () => {
|
|
87
|
+
const devcheckPromise = (async () => {
|
|
37
88
|
try {
|
|
38
89
|
await import("@cldmv/slothlet/devcheck");
|
|
39
90
|
} catch {
|
|
40
|
-
//
|
|
91
|
+
// Ignore errors (e.g., devcheck.mjs not found in production)
|
|
92
|
+
// devcheck.mjs uses process.exit() for environment errors
|
|
41
93
|
}
|
|
42
94
|
})();
|
|
43
95
|
|
|
@@ -67,30 +119,15 @@ function normalizeRuntimeType(runtime) {
|
|
|
67
119
|
*
|
|
68
120
|
*/
|
|
69
121
|
export default async function slothlet(options = {}) {
|
|
70
|
-
//
|
|
122
|
+
// Wait for devcheck to complete before proceeding
|
|
123
|
+
await devcheckPromise;
|
|
124
|
+
|
|
71
125
|
// Dynamic imports after environment check
|
|
72
126
|
const mod = await import("@cldmv/slothlet/slothlet");
|
|
73
127
|
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
const api = await build(options);
|
|
77
|
-
|
|
78
|
-
// Use the same runtime selection logic as slothlet.mjs
|
|
79
|
-
const normalizedRuntime = normalizeRuntimeType(options.runtime);
|
|
80
|
-
let runtimeModule;
|
|
81
|
-
if (normalizedRuntime === "live") {
|
|
82
|
-
runtimeModule = await import("@cldmv/slothlet/runtime/live");
|
|
83
|
-
} else {
|
|
84
|
-
// Default to AsyncLocalStorage runtime (original master branch implementation)
|
|
85
|
-
runtimeModule = await import("@cldmv/slothlet/runtime/async");
|
|
86
|
-
}
|
|
87
|
-
const { makeWrapper } = runtimeModule;
|
|
88
|
-
|
|
89
|
-
// Prefer an explicit instance context the internal attached to the API (api.__ctx),
|
|
90
|
-
// else fall back to module-level pieces if you expose them.
|
|
91
|
-
const ctx = api?.__ctx ?? { self: mod.self, context: mod.context, reference: mod.reference };
|
|
128
|
+
const slothlet = mod.slothlet ?? mod.default;
|
|
92
129
|
|
|
93
|
-
return
|
|
130
|
+
return slothlet(options);
|
|
94
131
|
}
|
|
95
132
|
|
|
96
133
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cldmv/slothlet",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"moduleVersions": {
|
|
5
5
|
"lazy": "1.3.1",
|
|
6
6
|
"eager": "1.3.1",
|
|
@@ -67,42 +67,134 @@
|
|
|
67
67
|
},
|
|
68
68
|
"types": "./types/dist/lib/modes/*.d.mts",
|
|
69
69
|
"import": "./dist/lib/modes/*.mjs"
|
|
70
|
+
},
|
|
71
|
+
"./builders/*": {
|
|
72
|
+
"slothlet-dev": {
|
|
73
|
+
"types": "./types/src/lib/builders/*.d.mts",
|
|
74
|
+
"import": "./src/lib/builders/*.mjs"
|
|
75
|
+
},
|
|
76
|
+
"types": "./types/dist/lib/builders/*.d.mts",
|
|
77
|
+
"import": "./dist/lib/builders/*.mjs"
|
|
78
|
+
},
|
|
79
|
+
"./handlers/*": {
|
|
80
|
+
"slothlet-dev": {
|
|
81
|
+
"types": "./types/src/lib/handlers/*.d.mts",
|
|
82
|
+
"import": "./src/lib/handlers/*.mjs"
|
|
83
|
+
},
|
|
84
|
+
"types": "./types/dist/lib/handlers/*.d.mts",
|
|
85
|
+
"import": "./dist/lib/handlers/*.mjs"
|
|
86
|
+
},
|
|
87
|
+
"./processors/*": {
|
|
88
|
+
"slothlet-dev": {
|
|
89
|
+
"types": "./types/src/lib/processors/*.d.mts",
|
|
90
|
+
"import": "./src/lib/processors/*.mjs"
|
|
91
|
+
},
|
|
92
|
+
"types": "./types/dist/lib/processors/*.d.mts",
|
|
93
|
+
"import": "./dist/lib/processors/*.mjs"
|
|
94
|
+
},
|
|
95
|
+
"./factories/*": {
|
|
96
|
+
"slothlet-dev": {
|
|
97
|
+
"types": "./types/src/lib/factories/*.d.mts",
|
|
98
|
+
"import": "./src/lib/factories/*.mjs"
|
|
99
|
+
},
|
|
100
|
+
"types": "./types/dist/lib/factories/*.d.mts",
|
|
101
|
+
"import": "./dist/lib/factories/*.mjs"
|
|
102
|
+
},
|
|
103
|
+
"./errors": {
|
|
104
|
+
"slothlet-dev": {
|
|
105
|
+
"types": "./types/src/lib/errors.d.mts",
|
|
106
|
+
"import": "./src/lib/errors.mjs"
|
|
107
|
+
},
|
|
108
|
+
"types": "./types/dist/lib/errors.d.mts",
|
|
109
|
+
"import": "./dist/lib/errors.mjs"
|
|
110
|
+
},
|
|
111
|
+
"./i18n": {
|
|
112
|
+
"slothlet-dev": {
|
|
113
|
+
"types": "./types/src/lib/i18n/translations.d.mts",
|
|
114
|
+
"import": "./src/lib/i18n/translations.mjs"
|
|
115
|
+
},
|
|
116
|
+
"types": "./types/dist/lib/i18n/translations.d.mts",
|
|
117
|
+
"import": "./dist/lib/i18n/translations.mjs"
|
|
70
118
|
}
|
|
71
119
|
},
|
|
72
120
|
"types": "./types/index.d.mts",
|
|
73
121
|
"scripts": {
|
|
74
|
-
"precommit": "node tools/precommit-validation.mjs",
|
|
75
|
-
"
|
|
76
|
-
"
|
|
122
|
+
"precommit": "node tools/dev/precommit-validation.mjs",
|
|
123
|
+
"debug": "node tests/debug-slothlet.mjs",
|
|
124
|
+
"i18n:check": "node tools/ci/check-i18n-languages.mjs",
|
|
125
|
+
"vitest": "node tests/vitests/run-all-vitest.mjs --workers 8",
|
|
126
|
+
"baseline": "npm run vitest -- --baseline",
|
|
127
|
+
"coverage": "npm run vitest -- --coverage-quiet",
|
|
128
|
+
"test": "npm run test:pre-build",
|
|
77
129
|
"test:pre-build": "node tests/test-conditional.mjs",
|
|
78
130
|
"test:post-build": "npm run test:types",
|
|
79
131
|
"test:complete": "node tests/test-conditional.mjs && npm run test:post-build",
|
|
80
|
-
"test:unit": "vitest --config .configs/vitest.config.mjs run",
|
|
81
132
|
"test:node": "node tests/run-all-tests.mjs",
|
|
82
133
|
"test:all": "node tests/test-conditional.mjs && npm run test:node",
|
|
83
134
|
"test:types": "node tests/validate-typescript.mjs",
|
|
84
|
-
"
|
|
85
|
-
"test:
|
|
86
|
-
"test:performance": "node tests/performance-benchmark.mjs",
|
|
87
|
-
"test:performance-aggregated": "node tests/performance-benchmark-aggregated.mjs",
|
|
135
|
+
"test:performance": "node tests/performance/performance-benchmark-aggregated.mjs",
|
|
136
|
+
"test:performance-simple": "node tests/performance/performance-benchmark.mjs",
|
|
88
137
|
"lint": "eslint --config .configs/eslint.config.mjs .",
|
|
89
|
-
"
|
|
138
|
+
"inspect": "node tools/dev/inspect-api-structure.mjs",
|
|
139
|
+
"check:node-versions": "node tools/dev/check-node-versions.mjs",
|
|
140
|
+
"analyze": "node tools/dev/analyze-errors.mjs",
|
|
141
|
+
"fix:headers": "node tools/dev/fix-headers.mjs",
|
|
142
|
+
"build": "npm run build:dev",
|
|
90
143
|
"build:ci": "npm run build:cleanup && npm run build:dist && npm run build:types && npm run build:exports && npm run test:types && npm run build:prepend-license && npm run ci:cleanup-src",
|
|
144
|
+
"build:dev": "npm run build:cleanup && npm run build:dist && npm run build:types && npm run build:exports && npm run test:types && npm run build:prepend-license && npm run build:cleanup",
|
|
91
145
|
"build:unsafe": "npm run build:cleanup && npm run build:dist && npm run build:types && npm run build:exports && npm run test:types && npm run build:prepend-license",
|
|
92
|
-
"ci:cleanup-src": "node tools/ci-cleanup-src.mjs",
|
|
146
|
+
"ci:cleanup-src": "node tools/ci/ci-cleanup-src.mjs",
|
|
93
147
|
"build:cleanup": "shx rm -rf types && shx rm -rf dist",
|
|
94
148
|
"build:dist": "shx mkdir -p dist && shx cp -r src/* dist/ && shx rm -rf dist/**/*.backup",
|
|
95
149
|
"build:types": "npx tsc -p .configs/tsconfig.dts.jsonc",
|
|
96
|
-
"build:
|
|
97
|
-
"build:
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"build:
|
|
101
|
-
"
|
|
102
|
-
"build:
|
|
103
|
-
"build:
|
|
104
|
-
"build:
|
|
105
|
-
"
|
|
150
|
+
"build:exports": "node tools/build/build-exports.mjs",
|
|
151
|
+
"build:prepend-license": "node tools/build/prepend-license.mjs dist",
|
|
152
|
+
"prepublish-check": "npm run build && npm pack && node tools/build/prepublish-check.mjs",
|
|
153
|
+
"docs:build": "npm run docs:build:slothlet && npm run docs:build:api-tests",
|
|
154
|
+
"docs:build:slothlet": "jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"src/{slothlet.mjs,lib/**/**/*.mjs}\" > docs/generated/API.md",
|
|
155
|
+
"publish:manual": "npm publish --access public",
|
|
156
|
+
"docs:build:api_adb_test": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_adb_test/**/*.mjs\" > docs/generated/api_tests/api_adb_test.md",
|
|
157
|
+
"docs:build:api_test": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_test/**/*.mjs\" > docs/generated/api_tests/api_test.md",
|
|
158
|
+
"docs:build:api_test-builtin-types": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_test_builtin_types/**/*.mjs\" > docs/generated/api_tests/api_test_builtin_types.md",
|
|
159
|
+
"docs:build:api_test-cjs": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_test_cjs/**/*.{mjs,cjs}\" > docs/generated/api_tests/api_test_cjs.md",
|
|
160
|
+
"docs:build:api_test-collections": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_test_collections/**/*.mjs\" > docs/generated/api_tests/api_test_collections.md",
|
|
161
|
+
"docs:build:api_test-collisions": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_test_collisions/**/*.mjs\" > docs/generated/api_tests/api_test_collisions.md",
|
|
162
|
+
"docs:build:api_test-impl": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_test_impl/**/*.mjs\" > docs/generated/api_tests/api_test_impl.md",
|
|
163
|
+
"docs:build:api_test-mixed": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_test_mixed/**/*.{mjs,cjs}\" > docs/generated/api_tests/api_test_mixed.md",
|
|
164
|
+
"docs:build:api_test-modes-debug": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_test_modes_debug/**/*.mjs\" > docs/generated/api_tests/api_test_modes_debug.md",
|
|
165
|
+
"docs:build:api_test-multi-root-fn": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_test_multi_root_fn/**/*.mjs\" > docs/generated/api_tests/api_test_multi_root_fn.md",
|
|
166
|
+
"docs:build:api_test-multiple-roots": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_test_multiple_roots/**/*.mjs\" > docs/generated/api_tests/api_test_multiple_roots.md",
|
|
167
|
+
"docs:build:api_test-primitives": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_test_primitives/**/*.mjs\" > docs/generated/api_tests/api_test_primitives.md",
|
|
168
|
+
"docs:build:api_test-reserved-name": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_test_reserved_name/**/*.mjs\" > docs/generated/api_tests/api_test_reserved_name.md",
|
|
169
|
+
"docs:build:api_test-root-issue": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_test_root_issue/**/*.mjs\" > docs/generated/api_tests/api_test_root_issue.md",
|
|
170
|
+
"docs:build:api_test-single-root-fn": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_test_single_root_fn/**/*.mjs\" > docs/generated/api_tests/api_test_single_root_fn.md",
|
|
171
|
+
"docs:build:api_tv_test": "shx mkdir -p docs/generated/api_tests && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/api_tv_test/**/*.mjs\" > docs/generated/api_tests/api_tv_test.md",
|
|
172
|
+
"docs:build:sf-addapi": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_addapi/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_addapi.md",
|
|
173
|
+
"docs:build:sf-addapi-function": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_addapi_function/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_addapi_function.md",
|
|
174
|
+
"docs:build:sf-addapi-subfolder": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_addapi_subfolder/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_addapi_subfolder.md",
|
|
175
|
+
"docs:build:sf-addapi-with-folders": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_addapi_with_folders/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_addapi_with_folders.md",
|
|
176
|
+
"docs:build:sf-bad-module": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_bad_module/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_bad_module.md",
|
|
177
|
+
"docs:build:sf-conflict": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_conflict/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_conflict.md",
|
|
178
|
+
"docs:build:sf-file-folder-lazy": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_file_folder_lazy/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_file_folder_lazy.md",
|
|
179
|
+
"docs:build:sf-fn-file-folder-lazy": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_fn_file_folder_lazy/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_fn_file_folder_lazy.md",
|
|
180
|
+
"docs:build:sf-fn-fn-folder": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_fn_fn_folder/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_fn_fn_folder.md",
|
|
181
|
+
"docs:build:sf-folder-config": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_folder_config/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_folder_config.md",
|
|
182
|
+
"docs:build:sf-folder-different": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_folder_different/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_folder_different.md",
|
|
183
|
+
"docs:build:sf-folder-with-named": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_folder_with_named/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_folder_with_named.md",
|
|
184
|
+
"docs:build:sf-lazy-fn-collision": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_lazy_fn_collision/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_lazy_fn_collision.md",
|
|
185
|
+
"docs:build:sf-lazy-nested-file-folder": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_lazy_nested_file_folder/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_lazy_nested_file_folder.md",
|
|
186
|
+
"docs:build:sf-multi-export-skip": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_multi_export_skip/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_multi_export_skip.md",
|
|
187
|
+
"docs:build:sf-multiple": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_multiple/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_multiple.md",
|
|
188
|
+
"docs:build:sf-nested": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_nested/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_nested.md",
|
|
189
|
+
"docs:build:sf-none": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_none/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_none.md",
|
|
190
|
+
"docs:build:sf-nowrap-cases": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_nowrap_cases/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_nowrap_cases.md",
|
|
191
|
+
"docs:build:sf-object-default-merge": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_object_default_merge/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_object_default_merge.md",
|
|
192
|
+
"docs:build:sf-obj-fn-folder": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_obj_fn_folder/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_obj_fn_folder.md",
|
|
193
|
+
"docs:build:sf-single": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_single/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_single.md",
|
|
194
|
+
"docs:build:sf-solo-subfolder": "shx mkdir -p docs/generated/api_tests/smart_flatten && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"api_tests/smart_flatten/api_smart_flatten_solo_subfolder/**/*.mjs\" > docs/generated/api_tests/smart_flatten/api_smart_flatten_solo_subfolder.md",
|
|
195
|
+
"docs:build:smart-flatten": "shx mkdir -p docs/generated/api_tests/smart_flatten && npm run docs:build:sf-addapi && npm run docs:build:sf-addapi-function && npm run docs:build:sf-addapi-subfolder && npm run docs:build:sf-addapi-with-folders && npm run docs:build:sf-bad-module && npm run docs:build:sf-conflict && npm run docs:build:sf-file-folder-lazy && npm run docs:build:sf-fn-file-folder-lazy && npm run docs:build:sf-fn-fn-folder && npm run docs:build:sf-folder-config && npm run docs:build:sf-folder-different && npm run docs:build:sf-folder-with-named && npm run docs:build:sf-lazy-fn-collision && npm run docs:build:sf-lazy-nested-file-folder && npm run docs:build:sf-multi-export-skip && npm run docs:build:sf-multiple && npm run docs:build:sf-nested && npm run docs:build:sf-none && npm run docs:build:sf-nowrap-cases && npm run docs:build:sf-object-default-merge && npm run docs:build:sf-obj-fn-folder && npm run docs:build:sf-single && npm run docs:build:sf-solo-subfolder",
|
|
196
|
+
"docs:build:api-tests": "npm run docs:build:api_adb_test && npm run docs:build:api_test && npm run docs:build:api_test-builtin-types && npm run docs:build:api_test-cjs && npm run docs:build:api_test-collections && npm run docs:build:api_test-collisions && npm run docs:build:api_test-impl && npm run docs:build:api_test-mixed && npm run docs:build:api_test-modes-debug && npm run docs:build:api_test-multi-root-fn && npm run docs:build:api_test-multiple-roots && npm run docs:build:api_test-primitives && npm run docs:build:api_test-reserved-name && npm run docs:build:api_test-root-issue && npm run docs:build:api_test-single-root-fn && npm run docs:build:api_tv_test && npm run docs:build:smart-flatten",
|
|
197
|
+
"docs:build:tools": "shx mkdir -p docs/tools && jsdoc2md -g grouped -m dl --no-cache --separators -c \".configs/jsdoc.config.json\" --helper \"docs/generated/helpers.cjs\" --template \"docs/generated/template.hbs\" \"tools/dev/**/*.mjs\" > docs/tools/build-tools.md"
|
|
106
198
|
},
|
|
107
199
|
"keywords": [
|
|
108
200
|
"api",
|
|
@@ -152,26 +244,47 @@
|
|
|
152
244
|
"url": "https://github.com/sponsors/shinrai"
|
|
153
245
|
},
|
|
154
246
|
"type": "module",
|
|
247
|
+
"peerDependencies": {
|
|
248
|
+
"esbuild": "^0.27.3",
|
|
249
|
+
"typescript": "^5.9.3"
|
|
250
|
+
},
|
|
251
|
+
"peerDependenciesMeta": {
|
|
252
|
+
"esbuild": {
|
|
253
|
+
"optional": true
|
|
254
|
+
},
|
|
255
|
+
"typescript": {
|
|
256
|
+
"optional": true
|
|
257
|
+
}
|
|
258
|
+
},
|
|
155
259
|
"devDependencies": {
|
|
260
|
+
"@cldmv/fix-headers": "^1.2.0",
|
|
261
|
+
"@cldmv/vitest-runner": "^1.0.3",
|
|
156
262
|
"@eslint/css": "^0.10.0",
|
|
157
263
|
"@eslint/js": "^9.33.0",
|
|
158
264
|
"@eslint/json": "^0.13.1",
|
|
159
265
|
"@eslint/markdown": "^7.2.0",
|
|
160
|
-
"@html-eslint/eslint-plugin": "^0.45.0",
|
|
161
266
|
"@html-eslint/parser": "^0.45.0",
|
|
162
267
|
"@types/node": "^24.9.1",
|
|
268
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
163
269
|
"chalk": "^5.6.0",
|
|
270
|
+
"chokidar": "^5.0.0",
|
|
164
271
|
"dmd": "^7.1.1",
|
|
165
|
-
"
|
|
272
|
+
"esbuild": "^0.27.3",
|
|
273
|
+
"eslint": "^10.0.2",
|
|
274
|
+
"globals": "^17.4.0",
|
|
166
275
|
"jsdoc": "^4.0.4",
|
|
167
276
|
"jsdoc-to-markdown": "^9.1.2",
|
|
168
277
|
"jsdoc2md": "^1.0.0",
|
|
169
278
|
"jsonc-parser": "^3.3.1",
|
|
170
279
|
"prettier": "^3.3.3",
|
|
171
280
|
"shx": "^0.4.0",
|
|
172
|
-
"typescript": "^5.9.
|
|
281
|
+
"typescript": "^5.9.3",
|
|
173
282
|
"vest": "^5.4.6",
|
|
174
|
-
"vitest": "^
|
|
283
|
+
"vitest": "^4.0.18"
|
|
284
|
+
},
|
|
285
|
+
"overrides": {
|
|
286
|
+
"minimatch": "^10.2.3",
|
|
287
|
+
"rollup": "^4.59.0"
|
|
175
288
|
},
|
|
176
289
|
"repository": {
|
|
177
290
|
"type": "git",
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manages unified API assignment logic
|
|
3
|
+
* @class ApiAssignment
|
|
4
|
+
* @extends ComponentBase
|
|
5
|
+
* @package
|
|
6
|
+
*
|
|
7
|
+
* @description
|
|
8
|
+
* Class-based utility for assigning values to API paths with collision detection,
|
|
9
|
+
* wrapper sync, and merge operations. Extends ComponentBase for Slothlet property access.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const assignment = new ApiAssignment(slothlet);
|
|
13
|
+
* assignment.assignToApiPath(api, "math", mathWrapper, {});
|
|
14
|
+
*/
|
|
15
|
+
export class ApiAssignment extends ComponentBase {
|
|
16
|
+
static slothletProperty: string;
|
|
17
|
+
/**
|
|
18
|
+
* Check if a value is a UnifiedWrapper proxy
|
|
19
|
+
* @param {unknown} value - Value to check
|
|
20
|
+
* @returns {boolean} True if value is a wrapper proxy
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
private isWrapperProxy;
|
|
24
|
+
/**
|
|
25
|
+
* Assign a value to an API object at a given property key.
|
|
26
|
+
* Handles wrapper sync, collision detection, and proper proxy preservation.
|
|
27
|
+
*
|
|
28
|
+
* @param {Object} targetApi - Target object to assign to (may be a UnifiedWrapper proxy)
|
|
29
|
+
* @param {string|symbol} key - Property name to assign
|
|
30
|
+
* @param {unknown} value - Value to assign (may be UnifiedWrapper proxy, raw value, etc.)
|
|
31
|
+
* @param {Object} options - Assignment options
|
|
32
|
+
* @param {boolean} [options.allowOverwrite=false] - Allow overwriting existing non-wrapper values
|
|
33
|
+
* @param {boolean} [options.mutateExisting=false] - Sync existing wrappers instead of replacing
|
|
34
|
+
* @param {boolean} [options.useCollisionDetection=false] - Enable collision detection using config.collision mode
|
|
35
|
+
* @param {Object} [options.config] - Slothlet config (uses config.collision.initial or config.collision.api)
|
|
36
|
+
* @param {string} [options.collisionContext="initial"] - Collision context: "initial" or "api"
|
|
37
|
+
* @param {Function} [options.syncWrapper] - Function to sync two wrapper proxies
|
|
38
|
+
* @returns {boolean} True if assignment succeeded, false if blocked by collision or other constraint
|
|
39
|
+
*
|
|
40
|
+
* @description
|
|
41
|
+
* This function encapsulates all assignment patterns from processFiles:
|
|
42
|
+
* - Direct assignment when no collision
|
|
43
|
+
* - Wrapper sync when both existing and new are wrappers
|
|
44
|
+
* - Collision detection using config.collision[context] mode (merge/replace/error/skip/warn)
|
|
45
|
+
* - Proper handling of UnifiedWrapper proxies (preserves them, doesn't unwrap)
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // Direct assignment
|
|
49
|
+
* assignment.assignToApiPath(api, "math", mathWrapper, {});
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* // Sync existing wrapper with new data
|
|
53
|
+
* assignment.assignToApiPath(api, "config", newConfigWrapper, { mutateExisting: true, syncWrapper });
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* // With collision detection
|
|
57
|
+
* assignment.assignToApiPath(api.math, "add", addFunction, {
|
|
58
|
+
* useCollisionDetection: true,
|
|
59
|
+
* config,
|
|
60
|
+
* collisionContext: "initial"
|
|
61
|
+
* });
|
|
62
|
+
*/
|
|
63
|
+
assignToApiPath(targetApi: any, key: string | symbol, value: unknown, options?: {
|
|
64
|
+
allowOverwrite?: boolean;
|
|
65
|
+
mutateExisting?: boolean;
|
|
66
|
+
useCollisionDetection?: boolean;
|
|
67
|
+
config?: any;
|
|
68
|
+
collisionContext?: string;
|
|
69
|
+
syncWrapper?: Function;
|
|
70
|
+
}): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Recursively merge a source object into a target object using assignToApiPath logic.
|
|
73
|
+
*
|
|
74
|
+
* @param {Object} targetApi - Target object
|
|
75
|
+
* @param {Object} sourceApi - Source object to merge from
|
|
76
|
+
* @param {Object} options - Assignment options (passed to assignToApiPath)
|
|
77
|
+
* @param {boolean} [options.removeMissing=false] - Remove keys from target that don't exist in source
|
|
78
|
+
* @returns {Promise<void>}
|
|
79
|
+
*
|
|
80
|
+
* @description
|
|
81
|
+
* Recursively walks the source object and assigns each value to the target using
|
|
82
|
+
* assignToApiPath. This provides consistent merge behavior for both initial build
|
|
83
|
+
* and hot reload operations.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* await assignment.mergeApiObjects(api.config, newConfigApi, {
|
|
87
|
+
* mutateExisting: true,
|
|
88
|
+
* syncWrapper,
|
|
89
|
+
* removeMissing: false
|
|
90
|
+
* });
|
|
91
|
+
*/
|
|
92
|
+
mergeApiObjects(targetApi: any, sourceApi: any, options?: {
|
|
93
|
+
removeMissing?: boolean;
|
|
94
|
+
}): Promise<void>;
|
|
95
|
+
}
|
|
96
|
+
import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
|
|
97
|
+
//# sourceMappingURL=api-assignment.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-assignment.d.mts","sourceRoot":"","sources":["../../../../dist/lib/builders/api-assignment.mjs"],"names":[],"mappings":"AA4BA;;;;;;;;;;;;;GAaG;AACH;IACC,gCAA0C;IAc1C;;;;;OAKG;IACH,uBAEC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,qCAlCW,MAAM,GAAC,MAAM,SACb,OAAO,YAEf;QAA0B,cAAc,GAAhC,OAAO;QACW,cAAc,GAAhC,OAAO;QACW,qBAAqB,GAAvC,OAAO;QACU,MAAM;QACN,gBAAgB,GAAjC,MAAM;QACa,WAAW;KACtC,GAAU,OAAO,CA+fnB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,0DAfG;QAA0B,aAAa,GAA/B,OAAO;KACf,GAAU,OAAO,CAAC,IAAI,CAAC,CA2FzB;CACD;8BA5pB6B,0CAA0C"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds final API with built-in methods attached
|
|
3
|
+
* @class ApiBuilder
|
|
4
|
+
* @extends ComponentBase
|
|
5
|
+
* @package
|
|
6
|
+
*
|
|
7
|
+
* @description
|
|
8
|
+
* Class-based builder for final API construction with built-in namespace attachment.
|
|
9
|
+
* Extends ComponentBase for common Slothlet property access.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const builder = new ApiBuilder(slothlet);
|
|
13
|
+
* const api = await builder.buildFinalAPI(userApi);
|
|
14
|
+
*/
|
|
15
|
+
export class ApiBuilder extends ComponentBase {
|
|
16
|
+
static slothletProperty: string;
|
|
17
|
+
/**
|
|
18
|
+
* Build final API with built-in methods attached
|
|
19
|
+
* @param {Object} userApi - User API object from mode builder
|
|
20
|
+
* @returns {Promise<Object>} Final API with built-ins attached
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
public buildFinalAPI(userApi: any): Promise<any>;
|
|
24
|
+
/**
|
|
25
|
+
* @param {object} userApi - User API object (for diagnostics).
|
|
26
|
+
* @returns {Promise<object>} Slothlet namespace object.
|
|
27
|
+
* @private
|
|
28
|
+
*
|
|
29
|
+
* @description
|
|
30
|
+
* Builds the slothlet namespace with version metadata, API controls, and lifecycle
|
|
31
|
+
* helpers for the current instance.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* const namespace = await this.createSlothletNamespace(api);
|
|
35
|
+
*/
|
|
36
|
+
private createSlothletNamespace;
|
|
37
|
+
/**
|
|
38
|
+
* Create root-level shutdown function (convenience)
|
|
39
|
+
* @returns {Function} Shutdown function that dynamically calls user hooks
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
42
|
+
private createShutdownFunction;
|
|
43
|
+
/**
|
|
44
|
+
* Create root-level run function (per-request context isolation)
|
|
45
|
+
* @returns {Function} Run function that executes callbacks with isolated context
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
private createRunFunction;
|
|
49
|
+
/**
|
|
50
|
+
* Create root-level scope function (structured per-request context with options)
|
|
51
|
+
* @returns {Function} Scope function that executes functions with isolated context
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
private createScopeFunction;
|
|
55
|
+
/**
|
|
56
|
+
* Create root-level destroy function (permanent destruction)
|
|
57
|
+
* @param {Object} api - Full API object
|
|
58
|
+
* @returns {Function} Destroy function that dynamically calls user hooks
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
private createDestroyFunction;
|
|
62
|
+
/**
|
|
63
|
+
* Attach built-in methods to user API
|
|
64
|
+
* @param {Object} userApi - User API object
|
|
65
|
+
* @param {Object} builtins - Built-in methods to attach
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
private attachBuiltins;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* i18n translation helpers exposed on every Slothlet namespace.
|
|
72
|
+
*/
|
|
73
|
+
export type I18nNamespace = {
|
|
74
|
+
/**
|
|
75
|
+
* - Set the active locale (e.g. "en-us").
|
|
76
|
+
*/
|
|
77
|
+
setLanguage: Function;
|
|
78
|
+
/**
|
|
79
|
+
* - Return the current active locale string.
|
|
80
|
+
*/
|
|
81
|
+
getLanguage: Function;
|
|
82
|
+
/**
|
|
83
|
+
* - Translate an error code with optional params.
|
|
84
|
+
*/
|
|
85
|
+
translate: Function;
|
|
86
|
+
/**
|
|
87
|
+
* - Alias for translate.
|
|
88
|
+
*/
|
|
89
|
+
t: Function;
|
|
90
|
+
/**
|
|
91
|
+
* - Initialise the i18n system with options.
|
|
92
|
+
*/
|
|
93
|
+
initI18n: Function;
|
|
94
|
+
};
|
|
95
|
+
import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
|
|
96
|
+
//# sourceMappingURL=api_builder.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api_builder.d.mts","sourceRoot":"","sources":["../../../../dist/lib/builders/api_builder.mjs"],"names":[],"mappings":"AAkEA;;;;;;;;;;;;;GAaG;AACH;IACC,gCAAuC;IAcvC;;;;;OAKG;IACH,oCAHa,OAAO,KAAQ,CAiG3B;IAED;;;;;;;;;;;OAWG;IACH,gCAghCC;IAED;;;;OAIG;IACH,+BAYC;IAED;;;;OAIG;IACH,0BAgCC;IAED;;;;OAIG;IACH,4BAoMC;IAED;;;;;OAKG;IACH,8BAyCC;IAED;;;;;OAKG;IACH,uBAgCC;CACD;;;;;;;;;;;;;;;;;;;;;;;;;;8BAriD6B,0CAA0C"}
|