@cldmv/slothlet 2.5.5 → 2.6.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/README.md +59 -5
- package/dist/lib/helpers/als-eventemitter.mjs +5 -4
- package/dist/lib/helpers/api_builder.mjs +27 -13
- package/dist/lib/helpers/auto-wrap.mjs +4 -2
- package/dist/lib/helpers/instance-manager.mjs +111 -0
- package/dist/lib/helpers/multidefault.mjs +12 -2
- package/dist/lib/modes/slothlet_eager.mjs +1 -1
- package/dist/lib/modes/slothlet_lazy.mjs +48 -5
- package/dist/lib/runtime/runtime-asynclocalstorage.mjs +435 -0
- package/dist/lib/runtime/runtime-livebindings.mjs +298 -0
- package/dist/lib/runtime/runtime.mjs +152 -349
- package/dist/slothlet.mjs +97 -11
- package/index.cjs +30 -39
- package/index.mjs +45 -15
- package/package.json +17 -1
- package/types/dist/lib/helpers/als-eventemitter.d.mts +3 -3
- package/types/dist/lib/helpers/als-eventemitter.d.mts.map +1 -1
- package/types/dist/lib/helpers/api_builder.d.mts.map +1 -1
- package/types/dist/lib/helpers/auto-wrap.d.mts.map +1 -1
- package/types/dist/lib/helpers/instance-manager.d.mts +41 -0
- package/types/dist/lib/helpers/instance-manager.d.mts.map +1 -0
- package/types/dist/lib/helpers/multidefault.d.mts +8 -3
- package/types/dist/lib/helpers/multidefault.d.mts.map +1 -1
- package/types/dist/lib/modes/slothlet_lazy.d.mts.map +1 -1
- package/types/dist/lib/runtime/runtime-asynclocalstorage.d.mts +58 -0
- package/types/dist/lib/runtime/runtime-asynclocalstorage.d.mts.map +1 -0
- package/types/dist/lib/runtime/runtime-livebindings.d.mts +58 -0
- package/types/dist/lib/runtime/runtime-livebindings.d.mts.map +1 -0
- package/types/dist/lib/runtime/runtime.d.mts +8 -57
- package/types/dist/lib/runtime/runtime.d.mts.map +1 -1
- package/types/dist/slothlet.d.mts +17 -9
- package/types/dist/slothlet.d.mts.map +1 -1
package/dist/slothlet.mjs
CHANGED
|
@@ -24,10 +24,38 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
24
24
|
|
|
25
25
|
import { resolvePathFromCaller } from "@cldmv/slothlet/helpers/resolve-from-caller";
|
|
26
26
|
import { sanitizePathName } from "@cldmv/slothlet/helpers/sanitize";
|
|
27
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
analyzeModule,
|
|
29
|
+
processModuleFromAnalysis,
|
|
30
|
+
getCategoryBuildingDecisions,
|
|
31
|
+
buildCategoryDecisions
|
|
32
|
+
} from "@cldmv/slothlet/helpers/api_builder";
|
|
33
|
+
import { updateInstanceData, cleanupInstance } from "./lib/helpers/instance-manager.mjs";
|
|
28
34
|
|
|
29
35
|
|
|
30
36
|
|
|
37
|
+
|
|
38
|
+
function normalizeRuntimeType(runtime) {
|
|
39
|
+
if (!runtime || typeof runtime !== "string") {
|
|
40
|
+
return "async";
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const normalized = runtime.toLowerCase().trim();
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
if (normalized === "async" || normalized === "asynclocal" || normalized === "asynclocalstorage") {
|
|
47
|
+
return "async";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
if (normalized === "live" || normalized === "livebindings" || normalized === "experimental") {
|
|
52
|
+
return "live";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
return "async";
|
|
57
|
+
}
|
|
58
|
+
|
|
31
59
|
const __filename = fileURLToPath(import.meta.url);
|
|
32
60
|
const __dirname = path.dirname(__filename);
|
|
33
61
|
|
|
@@ -113,6 +141,7 @@ const slothletObject = {
|
|
|
113
141
|
config: { lazy: false, apiDepth: Infinity, debug: DEBUG, dir: null, sanitize: null },
|
|
114
142
|
_dispose: null,
|
|
115
143
|
_boundAPIShutdown: null,
|
|
144
|
+
instanceId: null,
|
|
116
145
|
|
|
117
146
|
|
|
118
147
|
async create(options = {}) {
|
|
@@ -122,6 +151,27 @@ const slothletObject = {
|
|
|
122
151
|
}
|
|
123
152
|
|
|
124
153
|
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
const { entry = import.meta.url, engine = "singleton", mode, api_mode = "auto" } = options ?? {};
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
const executionEngine = mode && ["singleton", "vm", "worker", "fork"].includes(mode) ? mode : engine;
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
let isLazyMode;
|
|
163
|
+
if (mode && ["lazy", "eager"].includes(mode)) {
|
|
164
|
+
isLazyMode = mode === "lazy";
|
|
165
|
+
} else {
|
|
166
|
+
isLazyMode = options.lazy !== undefined ? options.lazy : this.config.lazy;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
const runtimeType = normalizeRuntimeType(options.runtime || "async");
|
|
171
|
+
const loadingModeStr = isLazyMode ? "lazy" : "eager";
|
|
172
|
+
this.instanceId = `slothlet_${runtimeType}_${loadingModeStr}_${Date.now()}_${Math.random().toString(36).slice(2, 11).padEnd(9, "0")}`;
|
|
173
|
+
|
|
174
|
+
|
|
125
175
|
if (!this.modes) {
|
|
126
176
|
this.modes = {};
|
|
127
177
|
const modesDir = path.join(__dirname, "lib", "modes");
|
|
@@ -163,18 +213,16 @@ const slothletObject = {
|
|
|
163
213
|
|
|
164
214
|
|
|
165
215
|
|
|
166
|
-
const { entry = import.meta.url, mode = "singleton", api_mode = "auto" } = options ?? {};
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
216
|
|
|
171
217
|
|
|
172
|
-
this.mode =
|
|
218
|
+
this.mode = executionEngine;
|
|
173
219
|
this.api_mode = api_mode;
|
|
174
220
|
let api;
|
|
175
221
|
let dispose;
|
|
176
|
-
if (
|
|
177
|
-
|
|
222
|
+
if (executionEngine === "singleton") {
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
const { context = null, reference = null, sanitize = null, engine, mode, ...loadConfig } = options;
|
|
178
226
|
this.context = context;
|
|
179
227
|
this.reference = reference;
|
|
180
228
|
|
|
@@ -184,6 +232,9 @@ const slothletObject = {
|
|
|
184
232
|
}
|
|
185
233
|
|
|
186
234
|
|
|
235
|
+
loadConfig.lazy = isLazyMode;
|
|
236
|
+
|
|
237
|
+
|
|
187
238
|
|
|
188
239
|
if (this.api_mode === "function") {
|
|
189
240
|
this.boundapi = function (...args) {
|
|
@@ -206,7 +257,8 @@ const slothletObject = {
|
|
|
206
257
|
return this.boundapi;
|
|
207
258
|
} else {
|
|
208
259
|
const { createEngine } = await import("./lib/engine/slothlet_engine.mjs");
|
|
209
|
-
|
|
260
|
+
|
|
261
|
+
({ api, dispose } = await createEngine({ entry, mode: executionEngine, ...options }));
|
|
210
262
|
|
|
211
263
|
|
|
212
264
|
if (typeof dispose === "function") {
|
|
@@ -226,6 +278,19 @@ const slothletObject = {
|
|
|
226
278
|
|
|
227
279
|
async load(config = {}, ctxRef = { context: null, reference: null }) {
|
|
228
280
|
this.config = { ...this.config, ...config };
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
this.config.runtime = normalizeRuntimeType(this.config.runtime);
|
|
284
|
+
|
|
285
|
+
if (!this.runtime) {
|
|
286
|
+
if (this.config.runtime === "live") {
|
|
287
|
+
this.runtime = await import("@cldmv/slothlet/runtime/live");
|
|
288
|
+
} else {
|
|
289
|
+
|
|
290
|
+
this.runtime = await import("@cldmv/slothlet/runtime/async");
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
229
294
|
|
|
230
295
|
|
|
231
296
|
let apiDir = this.config.dir || "api";
|
|
@@ -339,7 +404,6 @@ const slothletObject = {
|
|
|
339
404
|
const { currentDepth = 0, maxDepth = Infinity, mode = "eager", subdirHandler } = options;
|
|
340
405
|
|
|
341
406
|
|
|
342
|
-
const { buildCategoryDecisions } = await import("@cldmv/slothlet/helpers/api_builder");
|
|
343
407
|
const decisions = await buildCategoryDecisions(categoryPath, {
|
|
344
408
|
currentDepth,
|
|
345
409
|
maxDepth,
|
|
@@ -815,9 +879,23 @@ const slothletObject = {
|
|
|
815
879
|
|
|
816
880
|
|
|
817
881
|
mutateLiveBindingFunction(self, newSelf);
|
|
818
|
-
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
const contextWithRuntime = {
|
|
885
|
+
...newContext,
|
|
886
|
+
runtimeType: this.config.runtime
|
|
887
|
+
};
|
|
888
|
+
Object.assign(context, contextWithRuntime || {});
|
|
819
889
|
Object.assign(reference, newReference || {});
|
|
820
890
|
|
|
891
|
+
|
|
892
|
+
if (this.instanceId) {
|
|
893
|
+
updateInstanceData(this.instanceId, "self", newSelf);
|
|
894
|
+
updateInstanceData(this.instanceId, "context", contextWithRuntime);
|
|
895
|
+
updateInstanceData(this.instanceId, "reference", newReference);
|
|
896
|
+
updateInstanceData(this.instanceId, "config", this.config);
|
|
897
|
+
}
|
|
898
|
+
|
|
821
899
|
this.safeDefine(this.boundapi, "__ctx", {
|
|
822
900
|
self: this.boundapi,
|
|
823
901
|
context: this.context,
|
|
@@ -1024,6 +1102,14 @@ const slothletObject = {
|
|
|
1024
1102
|
this.reference = {};
|
|
1025
1103
|
this._dispose = null;
|
|
1026
1104
|
this._boundAPIShutdown = null;
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
|
|
1109
|
+
if (this.instanceId) {
|
|
1110
|
+
await cleanupInstance(this.instanceId);
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1027
1113
|
if (apiError || internalError) throw apiError || internalError;
|
|
1028
1114
|
}
|
|
1029
1115
|
} finally {
|
package/index.cjs
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* @Project: @cldmv/slothlet
|
|
3
|
+
* @Filename: /index.cjs
|
|
4
|
+
* @Date: 2025-11-09 11:15:17 -08:00 (1762715717)
|
|
5
|
+
* @Author: Nate Hyson <CLDMV>
|
|
6
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
7
|
+
* -----
|
|
8
|
+
* @Last modified by: Nate Hyson <CLDMV> (Shinrai@users.noreply.github.com)
|
|
9
|
+
* @Last modified time: 2025-11-09 14:43:17 -08:00 (1762728197)
|
|
10
|
+
* -----
|
|
11
|
+
* @Copyright: Copyright (c) 2013-2025 Catalyzed Motivation Inc. All rights reserved.
|
|
4
12
|
*/
|
|
5
13
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
(async () => {
|
|
11
|
-
try {
|
|
12
|
-
await import("@cldmv/slothlet/devcheck");
|
|
13
|
-
} catch {
|
|
14
|
-
// ignore
|
|
15
|
-
}
|
|
16
|
-
})();
|
|
14
|
+
/**
|
|
15
|
+
* @fileoverview CommonJS entry point for @cldmv/slothlet - imports ESM implementation for single source of truth.
|
|
16
|
+
* @module @cldmv/slothlet
|
|
17
|
+
*/
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
20
|
+
* CommonJS entry that dynamically imports the ESM implementation.
|
|
21
|
+
* This ensures single source of truth in index.mjs while maintaining CJS compatibility.
|
|
22
|
+
* Eliminates code duplication between entry points and ensures consistent behavior.
|
|
21
23
|
* @public
|
|
22
24
|
* @async
|
|
23
|
-
*
|
|
24
25
|
* @param {object} [options={}] - Configuration options for the slothlet instance
|
|
25
26
|
* @param {string} [options.dir="api"] - Directory to load API modules from
|
|
26
27
|
* @param {boolean} [options.lazy=false] - Use lazy loading (true) or eager loading (false)
|
|
@@ -28,38 +29,28 @@ const modPromise = import("@cldmv/slothlet/slothlet");
|
|
|
28
29
|
* @param {boolean} [options.debug=false] - Enable debug logging
|
|
29
30
|
* @param {string} [options.mode="singleton"] - Execution mode (singleton, vm, worker, fork)
|
|
30
31
|
* @param {string} [options.api_mode="auto"] - API structure mode (auto, function, object)
|
|
32
|
+
* @param {string} [options.runtime] - Runtime type ("async", "asynclocalstorage", "live", "livebindings", "experimental")
|
|
31
33
|
* @param {object} [options.context={}] - Context data for live bindings
|
|
32
34
|
* @param {object} [options.reference={}] - Reference objects to merge into API root
|
|
33
35
|
* @returns {Promise<function|object>} The bound API object with live-binding context
|
|
34
36
|
*
|
|
35
|
-
* @example // CJS
|
|
37
|
+
* @example // CJS usage
|
|
36
38
|
* const slothlet = require("@cldmv/slothlet");
|
|
37
39
|
* const api = await slothlet({ dir: "./api", context: { user: "alice" } });
|
|
38
40
|
* console.log(api.config.username); // Access configuration
|
|
41
|
+
*
|
|
42
|
+
* @example // CJS usage with runtime selection
|
|
43
|
+
* const slothlet = require("@cldmv/slothlet");
|
|
44
|
+
* const api = await slothlet({ dir: "./api", runtime: "live" });
|
|
45
|
+
*
|
|
46
|
+
* @example // CJS named destructuring
|
|
47
|
+
* const { slothlet } = require("@cldmv/slothlet");
|
|
48
|
+
* const api = await slothlet({ dir: "./api" });
|
|
39
49
|
*/
|
|
40
50
|
async function slothlet(options = {}) {
|
|
41
|
-
|
|
42
|
-
const {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const api = await build(options);
|
|
46
|
-
|
|
47
|
-
// Prefer an explicit instance context the internal attached to the API (api.__ctx),
|
|
48
|
-
// else fall back to module-level pieces if you expose them.
|
|
49
|
-
const ctx = api?.__ctx ?? { self: mod.self, context: mod.context, reference: mod.reference };
|
|
50
|
-
|
|
51
|
-
// console.log("[DEBUG index.cjs] Context setup:", {
|
|
52
|
-
// hasApiCtx: !!api?.__ctx,
|
|
53
|
-
// ctxSelfType: typeof ctx.self,
|
|
54
|
-
// ctxSelfKeys: Object.keys(ctx.self || {}),
|
|
55
|
-
// ctxContextType: typeof ctx.context,
|
|
56
|
-
// ctxContextKeys: Object.keys(ctx.context || {}),
|
|
57
|
-
// ctxReferenceType: typeof ctx.reference,
|
|
58
|
-
// ctxReferenceKeys: Object.keys(ctx.reference || {}),
|
|
59
|
-
// fallbackToMod: !api?.__ctx
|
|
60
|
-
// });
|
|
61
|
-
|
|
62
|
-
return makeWrapper(ctx)(api);
|
|
51
|
+
// Dynamic import of ESM entry point - single source of truth
|
|
52
|
+
const { default: esmSlothlet } = await import("./index.mjs");
|
|
53
|
+
return esmSlothlet(options);
|
|
63
54
|
}
|
|
64
55
|
|
|
65
56
|
/**
|
package/index.mjs
CHANGED
|
@@ -3,6 +3,35 @@
|
|
|
3
3
|
* @module @cldmv/slothlet
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Normalize runtime input to internal standard format.
|
|
8
|
+
* @function normalizeRuntimeType
|
|
9
|
+
* @param {string} runtime - Input runtime type (various formats accepted)
|
|
10
|
+
* @returns {string} Normalized runtime type ("async" or "live")
|
|
11
|
+
* @internal
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
function normalizeRuntimeType(runtime) {
|
|
15
|
+
if (!runtime || typeof runtime !== "string") {
|
|
16
|
+
return "async"; // Default to AsyncLocalStorage
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const normalized = runtime.toLowerCase().trim();
|
|
20
|
+
|
|
21
|
+
// AsyncLocalStorage runtime variants
|
|
22
|
+
if (normalized === "async" || normalized === "asynclocal" || normalized === "asynclocalstorage") {
|
|
23
|
+
return "async";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Live bindings runtime variants
|
|
27
|
+
if (normalized === "live" || normalized === "livebindings" || normalized === "experimental") {
|
|
28
|
+
return "live";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Default to async for unknown values
|
|
32
|
+
return "async";
|
|
33
|
+
}
|
|
34
|
+
|
|
6
35
|
// Development environment check (must happen before slothlet imports)
|
|
7
36
|
(async () => {
|
|
8
37
|
try {
|
|
@@ -20,10 +49,11 @@
|
|
|
20
49
|
*
|
|
21
50
|
* @param {object} [options={}] - Configuration options for the slothlet instance
|
|
22
51
|
* @param {string} [options.dir="api"] - Directory to load API modules from
|
|
23
|
-
* @param {boolean} [options.lazy=false] - Use lazy loading (true) or eager loading (false)
|
|
52
|
+
* @param {boolean} [options.lazy=false] - Use lazy loading (true) or eager loading (false) - legacy option
|
|
53
|
+
* @param {string} [options.mode] - Loading mode ("lazy", "eager") or execution mode ("singleton", "vm", "worker", "fork") - takes precedence over lazy option
|
|
54
|
+
* @param {string} [options.engine="singleton"] - Execution mode (singleton, vm, worker, fork)
|
|
24
55
|
* @param {number} [options.apiDepth=Infinity] - Maximum directory depth to scan
|
|
25
56
|
* @param {boolean} [options.debug=false] - Enable debug logging
|
|
26
|
-
* @param {string} [options.mode="singleton"] - Execution mode (singleton, vm, worker, fork)
|
|
27
57
|
* @param {string} [options.api_mode="auto"] - API structure mode (auto, function, object)
|
|
28
58
|
* @param {object} [options.context={}] - Context data for live bindings
|
|
29
59
|
* @param {object} [options.reference={}] - Reference objects to merge into API root
|
|
@@ -37,28 +67,28 @@
|
|
|
37
67
|
*/
|
|
38
68
|
export default async function slothlet(options = {}) {
|
|
39
69
|
// Dynamic imports after environment check
|
|
40
|
-
|
|
70
|
+
// Dynamic imports after environment check
|
|
71
|
+
const mod = await import("@cldmv/slothlet/slothlet");
|
|
41
72
|
|
|
42
|
-
const { makeWrapper } = runtime;
|
|
43
73
|
const build = mod.slothlet ?? mod.default;
|
|
44
74
|
|
|
45
75
|
const api = await build(options);
|
|
46
76
|
|
|
77
|
+
// Use the same runtime selection logic as slothlet.mjs
|
|
78
|
+
const normalizedRuntime = normalizeRuntimeType(options.runtime);
|
|
79
|
+
let runtimeModule;
|
|
80
|
+
if (normalizedRuntime === "live") {
|
|
81
|
+
runtimeModule = await import("@cldmv/slothlet/runtime/live");
|
|
82
|
+
} else {
|
|
83
|
+
// Default to AsyncLocalStorage runtime (original master branch implementation)
|
|
84
|
+
runtimeModule = await import("@cldmv/slothlet/runtime/async");
|
|
85
|
+
}
|
|
86
|
+
const { makeWrapper } = runtimeModule;
|
|
87
|
+
|
|
47
88
|
// Prefer an explicit instance context the internal attached to the API (api.__ctx),
|
|
48
89
|
// else fall back to module-level pieces if you expose them.
|
|
49
90
|
const ctx = api?.__ctx ?? { self: mod.self, context: mod.context, reference: mod.reference };
|
|
50
91
|
|
|
51
|
-
// console.log("[DEBUG index.mjs] Context setup:", {
|
|
52
|
-
// hasApiCtx: !!api?.__ctx,
|
|
53
|
-
// ctxSelfType: typeof ctx.self,
|
|
54
|
-
// ctxSelfKeys: Object.keys(ctx.self || {}),
|
|
55
|
-
// ctxContextType: typeof ctx.context,
|
|
56
|
-
// ctxContextKeys: Object.keys(ctx.context || {}),
|
|
57
|
-
// ctxReferenceType: typeof ctx.reference,
|
|
58
|
-
// ctxReferenceKeys: Object.keys(ctx.reference || {}),
|
|
59
|
-
// fallbackToMod: !api?.__ctx
|
|
60
|
-
// });
|
|
61
|
-
// return api;
|
|
62
92
|
return makeWrapper(ctx)(api);
|
|
63
93
|
}
|
|
64
94
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cldmv/slothlet",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"moduleVersions": {
|
|
5
5
|
"lazy": "1.3.0",
|
|
6
6
|
"eager": "1.3.0"
|
|
@@ -34,6 +34,22 @@
|
|
|
34
34
|
"types": "./types/dist/lib/runtime/runtime.d.mts",
|
|
35
35
|
"import": "./dist/lib/runtime/runtime.mjs"
|
|
36
36
|
},
|
|
37
|
+
"./runtime/async": {
|
|
38
|
+
"development": {
|
|
39
|
+
"types": "./types/src/lib/runtime/runtime-asynclocalstorage.d.mts",
|
|
40
|
+
"import": "./src/lib/runtime/runtime-asynclocalstorage.mjs"
|
|
41
|
+
},
|
|
42
|
+
"types": "./types/dist/lib/runtime/runtime-asynclocalstorage.d.mts",
|
|
43
|
+
"import": "./dist/lib/runtime/runtime-asynclocalstorage.mjs"
|
|
44
|
+
},
|
|
45
|
+
"./runtime/live": {
|
|
46
|
+
"development": {
|
|
47
|
+
"types": "./types/src/lib/runtime/runtime-livebindings.d.mts",
|
|
48
|
+
"import": "./src/lib/runtime/runtime-livebindings.mjs"
|
|
49
|
+
},
|
|
50
|
+
"types": "./types/dist/lib/runtime/runtime-livebindings.d.mts",
|
|
51
|
+
"import": "./dist/lib/runtime/runtime-livebindings.mjs"
|
|
52
|
+
},
|
|
37
53
|
"./helpers/*": {
|
|
38
54
|
"development": {
|
|
39
55
|
"types": "./types/src/lib/helpers/*.d.mts",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @function enableAlsForEventEmitters
|
|
5
5
|
* @package
|
|
6
|
-
* @param {AsyncLocalStorage} [als
|
|
6
|
+
* @param {AsyncLocalStorage} [als] - The AsyncLocalStorage instance to use (defaults to slothlet's shared instance)
|
|
7
7
|
*
|
|
8
8
|
* @description
|
|
9
9
|
* Patches EventEmitter.prototype to automatically preserve AsyncLocalStorage context
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
* import { enableAlsForEventEmitters } from "./als-eventemitter.mjs";
|
|
19
19
|
* enableAlsForEventEmitters(als);
|
|
20
20
|
*/
|
|
21
|
-
export function enableAlsForEventEmitters(als?: AsyncLocalStorage): void;
|
|
22
|
-
|
|
21
|
+
export function enableAlsForEventEmitters(als?: AsyncLocalStorage<any>): void;
|
|
22
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
23
23
|
//# sourceMappingURL=als-eventemitter.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"als-eventemitter.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/als-eventemitter.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"als-eventemitter.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/als-eventemitter.mjs"],"names":[],"mappings":"AAuCA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8EAqJC;kCA9KiC,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api_builder.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/api_builder.mjs"],"names":[],"mappings":"
|
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EAAxB,MAAM;CACd,GAAU,OAAO,CAAC,MAAM,CAAC,CAmR3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,kCAtBW,MAAM,YAEd;IAA0B,IAAI,GAAtB,OAAO;IACU,QAAQ,GAAzB,MAAM;IACU,QAAQ,EAAxB,MAAM;CACd,GAAU,OAAO,CAAC,MAAM,WAAS,CAAC,CA2HpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qDAvBW,MAAM,YAEd;IAAyB,YAAY,GAA7B,MAAM;IACW,QAAQ,GAAzB,MAAM;IACW,IAAI,GAArB,MAAM;IACa,aAAa;IAChB,QAAQ,EAAxB,MAAM;CACd,GAAU,OAAO,CAAC,MAAM,CAAC,CAyZ3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-wrap.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/auto-wrap.mjs"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,kDAdW,SAAS,GACP,SAAS,
|
|
1
|
+
{"version":3,"file":"auto-wrap.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/auto-wrap.mjs"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,kDAdW,SAAS,GACP,SAAS,CA6CrB;AAED;;;;;;;GAOG;AACH,0BAJa,OAAO,CAAC,SAAS,CAAC,CAO9B;wBAGY,cAAc,UAAU,CAAC;wBACzB,OAAO,UAAU,EAAE,MAAM"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get instance data by ID
|
|
3
|
+
* @param {string} instanceId - Instance identifier
|
|
4
|
+
* @returns {object|null} Instance data or null if not found
|
|
5
|
+
*/
|
|
6
|
+
export function getInstanceData(instanceId: string): object | null;
|
|
7
|
+
/**
|
|
8
|
+
* Update instance data for a specific key
|
|
9
|
+
* @param {string} instanceId - Instance identifier
|
|
10
|
+
* @param {string} key - Data key (self, context, reference)
|
|
11
|
+
* @param {any} value - Data value
|
|
12
|
+
* @returns {void}
|
|
13
|
+
*/
|
|
14
|
+
export function updateInstanceData(instanceId: string, key: string, value: any): void;
|
|
15
|
+
/**
|
|
16
|
+
* Clean up instance data when no longer needed
|
|
17
|
+
* @param {string} instanceId - Instance identifier
|
|
18
|
+
* @returns {Promise<void>}
|
|
19
|
+
*/
|
|
20
|
+
export function cleanupInstance(instanceId: string): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Set the currently active instance (called during module loading)
|
|
23
|
+
* @param {string|null} instanceId - Instance ID to set as active
|
|
24
|
+
*/
|
|
25
|
+
export function setActiveInstance(instanceId: string | null): void;
|
|
26
|
+
/**
|
|
27
|
+
* Get the current active instance ID
|
|
28
|
+
* @returns {string|null} Current active instance ID
|
|
29
|
+
*/
|
|
30
|
+
export function getCurrentActiveInstanceId(): string | null;
|
|
31
|
+
/**
|
|
32
|
+
* Detect current instance ID from stack trace
|
|
33
|
+
* @returns {string|null} Detected instance ID or null
|
|
34
|
+
*/
|
|
35
|
+
export function detectCurrentInstanceId(): string | null;
|
|
36
|
+
/**
|
|
37
|
+
* Get all registered instance IDs
|
|
38
|
+
* @returns {string[]} Array of instance IDs
|
|
39
|
+
*/
|
|
40
|
+
export function getAllInstanceIds(): string[];
|
|
41
|
+
//# sourceMappingURL=instance-manager.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance-manager.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/instance-manager.mjs"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH,4CAHW,MAAM,GACJ,MAAM,GAAC,IAAI,CAIvB;AAED;;;;;;GAMG;AACH,+CALW,MAAM,OACN,MAAM,SACN,GAAG,GACD,IAAI,CAqBhB;AAED;;;;GAIG;AACH,4CAHW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CASzB;AAED;;;GAGG;AACH,8CAFW,MAAM,GAAC,IAAI,QAKrB;AAED;;;GAGG;AACH,8CAFa,MAAM,GAAC,IAAI,CAIvB;AAED;;;GAGG;AACH,2CAFa,MAAM,GAAC,IAAI,CAkCvB;AAED;;;GAGG;AACH,qCAFa,MAAM,EAAE,CAIpB"}
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* @private
|
|
5
5
|
* @param {Array<{name: string}>} moduleFiles - Array of module file objects with name property
|
|
6
6
|
* @param {string} baseDir - Base directory path containing the modules
|
|
7
|
-
* @param {
|
|
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
|
|
8
10
|
* @returns {Promise<{
|
|
9
11
|
* totalDefaultExports: number,
|
|
10
12
|
* hasMultipleDefaultExports: boolean,
|
|
@@ -13,14 +15,17 @@
|
|
|
13
15
|
* defaultExportFiles: Array<{fileName: string, rawModule: object}>
|
|
14
16
|
* }>} Analysis results
|
|
15
17
|
* @example // Internal usage in slothlet modes
|
|
16
|
-
* const analysis = await multidefault_analyzeModules(moduleFiles, categoryPath, config.debug);
|
|
18
|
+
* const analysis = await multidefault_analyzeModules(moduleFiles, categoryPath, { debug: config.debug, instance });
|
|
17
19
|
* if (analysis.hasMultipleDefaultExports) {
|
|
18
20
|
* // Handle multi-default context
|
|
19
21
|
* }
|
|
20
22
|
*/
|
|
21
23
|
export function multidefault_analyzeModules(moduleFiles: Array<{
|
|
22
24
|
name: string;
|
|
23
|
-
}>, baseDir: string,
|
|
25
|
+
}>, baseDir: string, options?: {
|
|
26
|
+
debug?: boolean;
|
|
27
|
+
instance?: object | null;
|
|
28
|
+
}): Promise<{
|
|
24
29
|
totalDefaultExports: number;
|
|
25
30
|
hasMultipleDefaultExports: boolean;
|
|
26
31
|
selfReferentialFiles: Set<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multidefault.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/multidefault.mjs"],"names":[],"mappings":"
|
|
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,CA8FJ;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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slothlet_lazy.d.mts","sourceRoot":"","sources":["../../../../dist/lib/modes/slothlet_lazy.mjs"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared AsyncLocalStorage instance for all slothlet instances.
|
|
3
|
+
* Provides unified context management across all EventEmitter wrappers.
|
|
4
|
+
* @type {AsyncLocalStorageType}
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export const sharedALS: AsyncLocalStorageType;
|
|
8
|
+
export function runWithCtx(ctx: object, fn: Function, thisArg: any, args: any[]): any;
|
|
9
|
+
export function getCtx(): object | null;
|
|
10
|
+
export function makeWrapper(ctx: object): Function;
|
|
11
|
+
/**
|
|
12
|
+
* @constant self
|
|
13
|
+
* @memberof module:@cldmv/slothlet/runtime
|
|
14
|
+
* @export module:@cldmv/slothlet/runtime
|
|
15
|
+
* @public
|
|
16
|
+
* @type {function|object}
|
|
17
|
+
*
|
|
18
|
+
* @description
|
|
19
|
+
* Live binding to the current instance's 'self' reference from AsyncLocalStorage context.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // Access current instance self
|
|
23
|
+
* console.log(self); // Current slothlet instance
|
|
24
|
+
*/
|
|
25
|
+
export const self: Function | object;
|
|
26
|
+
/**
|
|
27
|
+
* @constant context
|
|
28
|
+
* @memberof module:@cldmv/slothlet/runtime
|
|
29
|
+
* @export module:@cldmv/slothlet/runtime
|
|
30
|
+
* @public
|
|
31
|
+
* @type {object}
|
|
32
|
+
*
|
|
33
|
+
* @description
|
|
34
|
+
* Live binding to the current instance's 'context' data from AsyncLocalStorage context.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* // Access current context data
|
|
38
|
+
* console.log(context); // Current context object
|
|
39
|
+
*/
|
|
40
|
+
export const context: object;
|
|
41
|
+
/**
|
|
42
|
+
* @constant reference
|
|
43
|
+
* @memberof module:@cldmv/slothlet/runtime
|
|
44
|
+
* @export module:@cldmv/slothlet/runtime
|
|
45
|
+
* @public
|
|
46
|
+
* @type {object}
|
|
47
|
+
*
|
|
48
|
+
* @description
|
|
49
|
+
* Live binding to the current instance's 'reference' object from AsyncLocalStorage context.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* // Access current reference object
|
|
53
|
+
* console.log(reference); // Current reference data
|
|
54
|
+
*/
|
|
55
|
+
export const reference: object;
|
|
56
|
+
export type AsyncLocalStorageType = AsyncLocalStorage<any>;
|
|
57
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
58
|
+
//# sourceMappingURL=runtime-asynclocalstorage.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-asynclocalstorage.d.mts","sourceRoot":"","sources":["../../../../dist/lib/runtime/runtime-asynclocalstorage.mjs"],"names":[],"mappings":"AAuCA;;;;;GAKG;AACH,wBAHU,qBAAqB,CAGkB;AAsB1C,gCAdI,MAAM,yBAEN,GAAG,gBAED,GAAG,CA6Bf;AAiBM,0BAZM,MAAM,GAAC,IAAI,CAY0B;AAiL3C,iCAjBI,MAAM,YAgIhB;AAuSD;;;;;;;;;;;;;GAaG;AACH,mBATU,WAAS,MAAM,CAS6B;AAEtD;;;;;;;;;;;;;GAaG;AACH,sBATU,MAAM,CAS4C;AAE5D;;;;;;;;;;;;;GAaG;AACH,wBATU,MAAM,CASgD;;kCA3rB9B,kBAAkB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context-aware function execution with temporary active instance override.
|
|
3
|
+
* Sets the active instance based on the context before calling the function,
|
|
4
|
+
* ensuring CJS runtime imports detect the correct instance.
|
|
5
|
+
* @param {object} ctx - Context object containing instanceId
|
|
6
|
+
* @param {Function} fn - Function to execute
|
|
7
|
+
* @param {any} thisArg - The this argument
|
|
8
|
+
* @param {Array} args - The function arguments
|
|
9
|
+
* @returns {any} The function result
|
|
10
|
+
*/
|
|
11
|
+
export function runWithCtx(ctx: object, fn: Function, thisArg: any, args: any[]): any;
|
|
12
|
+
/**
|
|
13
|
+
* Legacy makeWrapper function for backwards compatibility.
|
|
14
|
+
* @internal
|
|
15
|
+
* @param {object} ctx - The context to bind
|
|
16
|
+
* @returns {function} A wrapper function
|
|
17
|
+
*/
|
|
18
|
+
export function makeWrapper(_: any): Function;
|
|
19
|
+
/**
|
|
20
|
+
* Legacy context management functions - kept for backwards compatibility
|
|
21
|
+
* but may not be needed with instance detection approach.
|
|
22
|
+
*/
|
|
23
|
+
export function getContext(): any;
|
|
24
|
+
export function setContext(newContext: any): void;
|
|
25
|
+
/**
|
|
26
|
+
* Live-binding reference to the current API instance.
|
|
27
|
+
* Automatically resolves to the appropriate instance based on calling context.
|
|
28
|
+
* @type {object}
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export const self: object;
|
|
32
|
+
/**
|
|
33
|
+
* Live-binding reference for contextual data.
|
|
34
|
+
* Automatically resolves to the appropriate instance context.
|
|
35
|
+
* @type {object}
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export const context: object;
|
|
39
|
+
/**
|
|
40
|
+
* Live-binding reference for reference data.
|
|
41
|
+
* Automatically resolves to the appropriate instance reference.
|
|
42
|
+
* @type {object}
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
export const reference: object;
|
|
46
|
+
/**
|
|
47
|
+
* Live-binding reference to the current instance ID.
|
|
48
|
+
* Automatically resolves to the current instance identifier.
|
|
49
|
+
* @type {string}
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export const instanceId: string;
|
|
53
|
+
export namespace contextManager {
|
|
54
|
+
export { getContext as get };
|
|
55
|
+
export { setContext as set };
|
|
56
|
+
export { runWithCtx };
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=runtime-livebindings.d.mts.map
|