@cldmv/slothlet 2.6.0 â 2.6.3
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
CHANGED
|
@@ -40,7 +40,7 @@ The name might suggest we're taking it easy, but don't be fooled. **Slothlet del
|
|
|
40
40
|
v2.0 represents a ground-up rewrite with enterprise-grade features:
|
|
41
41
|
|
|
42
42
|
- **Universal Module Support**: Load both ESM (`.mjs`) and CommonJS (`.cjs`) files seamlessly
|
|
43
|
-
- **
|
|
43
|
+
- **Dual Runtime System**: Choose AsyncLocalStorage or live-bindings for context isolation
|
|
44
44
|
- **4.3x Faster Startup**: Lazy mode achieves 564.17Ξs vs 2.45ms in eager mode
|
|
45
45
|
- **Copy-Left Materialization**: Once loaded, modules stay materialized for optimal performance
|
|
46
46
|
- **Zero Dependencies**: Pure Node.js implementation with no external dependencies
|
|
@@ -113,14 +113,14 @@ v2.0 represents a ground-up rewrite with enterprise-grade features:
|
|
|
113
113
|
### ð **Advanced Binding System**
|
|
114
114
|
|
|
115
115
|
- **Live Bindings**: Dynamic context and reference binding for runtime API mutation
|
|
116
|
-
- **
|
|
116
|
+
- **Context Isolation**: Dual runtime options for per-instance context isolation with seamless integration
|
|
117
117
|
- **Copy-Left Preservation**: Materialized functions stay materialized, preserving performance gains
|
|
118
118
|
- **Bubble-Up Updates**: Parent API synchronization ensures consistency across the API tree
|
|
119
119
|
- **Mixed Module Support**: Seamlessly blend ESM and CommonJS modules in the same API
|
|
120
120
|
|
|
121
121
|
### ð **Developer Experience**
|
|
122
122
|
|
|
123
|
-
- **
|
|
123
|
+
- **Enhanced Error Handling**: Clear JavaScript errors with module suggestions and descriptive errors (planned for v3.0.0)
|
|
124
124
|
- **TypeScript-Friendly**: Comprehensive JSDoc annotations for excellent editor support with auto-generated declarations
|
|
125
125
|
- **Configurable Debug**: Detailed logging for development and troubleshooting via CLI flags or environment variables
|
|
126
126
|
- **Multiple Instances**: Parameter-based isolation for complex applications with instance ID management
|
|
@@ -132,7 +132,7 @@ v2.0 represents a ground-up rewrite with enterprise-grade features:
|
|
|
132
132
|
- **Universal Loading**: CommonJS and ESM files work together seamlessly
|
|
133
133
|
- **Zero Dependencies**: Lightweight footprint with no external dependencies
|
|
134
134
|
- **Cross-Platform**: Works seamlessly across all Node.js environments
|
|
135
|
-
- **Extensible**: Modular architecture
|
|
135
|
+
- **Extensible**: Modular architecture with flexible API composition patterns
|
|
136
136
|
|
|
137
137
|
---
|
|
138
138
|
|
|
@@ -140,11 +140,16 @@ v2.0 represents a ground-up rewrite with enterprise-grade features:
|
|
|
140
140
|
|
|
141
141
|
### Requirements
|
|
142
142
|
|
|
143
|
-
- **Node.js
|
|
144
|
-
- **
|
|
143
|
+
- **Node.js v12.20.0 or higher** (for ESM support with `import`/`export`)
|
|
144
|
+
- **Node.js v16.4.0 or higher** (recommended for AsyncLocalStorage runtime - `runtime: "async"`)
|
|
145
145
|
|
|
146
146
|
> [!IMPORTANT]
|
|
147
|
-
> **v2.x
|
|
147
|
+
> **v2.x Runtime Options**: Slothlet v2.x supports two runtime systems:
|
|
148
|
+
>
|
|
149
|
+
> - **AsyncLocalStorage Runtime** (`runtime: "async"`) - Default, requires Node.js v16.4.0+ for context isolation
|
|
150
|
+
> - **Live Bindings Runtime** (`runtime: "live"`) - Advanced system, works on Node.js v12.20.0+ without AsyncLocalStorage
|
|
151
|
+
>
|
|
152
|
+
> Both runtimes provide full live-binding capabilities with `self`, `context`, and `reference` support across ESM and CommonJS modules. Use `runtime: "live"` for older Node.js versions or advanced binding scenarios.
|
|
148
153
|
|
|
149
154
|
### Install
|
|
150
155
|
|
|
@@ -194,6 +199,28 @@ const result = api.math.multiply(4, 5); // 20
|
|
|
194
199
|
const mixedResult = await api.interop.processData({ data: "test" }); // CJS+ESM interop
|
|
195
200
|
```
|
|
196
201
|
|
|
202
|
+
### Runtime Selection
|
|
203
|
+
|
|
204
|
+
```javascript
|
|
205
|
+
// AsyncLocalStorage runtime (default) - requires Node.js v16.4.0+
|
|
206
|
+
const apiAsync = await slothlet({
|
|
207
|
+
dir: "./api",
|
|
208
|
+
runtime: "async", // or "asynclocalstorage"
|
|
209
|
+
context: { user: "alice" }
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
// Live bindings runtime - works on Node.js v12.20.0+
|
|
213
|
+
const apiLive = await slothlet({
|
|
214
|
+
dir: "./api",
|
|
215
|
+
runtime: "live", // or "livebindings"
|
|
216
|
+
context: { user: "bob" }
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// Both provide identical live-binding capabilities
|
|
220
|
+
import { self, context, reference } from "@cldmv/slothlet/runtime";
|
|
221
|
+
// context.user is available in your modules regardless of runtime choice
|
|
222
|
+
```
|
|
223
|
+
|
|
197
224
|
### Lazy Loading Mode
|
|
198
225
|
|
|
199
226
|
```javascript
|
|
@@ -260,7 +287,7 @@ const api = await slothlet({
|
|
|
260
287
|
|
|
261
288
|
### Sanitize Options Examples
|
|
262
289
|
|
|
263
|
-
Transform module filenames into clean, professional API property names:
|
|
290
|
+
Transform module filenames into clean, professional API property names with sophisticated control:
|
|
264
291
|
|
|
265
292
|
```javascript
|
|
266
293
|
// Without sanitize options (default behavior)
|
|
@@ -272,23 +299,96 @@ const api = await slothlet({ dir: "./api" });
|
|
|
272
299
|
const api = await slothlet({
|
|
273
300
|
dir: "./api",
|
|
274
301
|
sanitize: {
|
|
275
|
-
lowerFirst: false,
|
|
302
|
+
lowerFirst: false, // Keep first character casing
|
|
303
|
+
preserveAllUpper: true, // Preserve identifiers like "COMMON_APPS"
|
|
304
|
+
preserveAllLower: false, // Transform identifiers like "common_apps"
|
|
276
305
|
rules: {
|
|
277
|
-
leave: ["parseJSON"], // Exact match preservation
|
|
278
|
-
|
|
279
|
-
|
|
306
|
+
leave: ["parseJSON"], // Exact match preservation (case-sensitive)
|
|
307
|
+
leaveInsensitive: ["*xml*"], // Case-insensitive preservation
|
|
308
|
+
upper: ["**url**", "ip", "http*"], // Force uppercase transformations
|
|
309
|
+
lower: ["id", "*id"] // Force lowercase transformations
|
|
280
310
|
}
|
|
281
311
|
}
|
|
282
312
|
});
|
|
283
313
|
// Result: api.buildURLWithParams, api.parseJSON, api.autoIP
|
|
284
314
|
```
|
|
285
315
|
|
|
316
|
+
**Comprehensive Sanitize Configuration:**
|
|
317
|
+
|
|
318
|
+
```javascript
|
|
319
|
+
const api = await slothlet({
|
|
320
|
+
dir: "./api",
|
|
321
|
+
sanitize: {
|
|
322
|
+
// Basic Options
|
|
323
|
+
lowerFirst: true, // Default: lowercase first character for camelCase
|
|
324
|
+
preserveAllUpper: true, // Keep "COMMON_APPS" unchanged
|
|
325
|
+
preserveAllLower: false, // Transform "common_apps" â "commonApps"
|
|
326
|
+
|
|
327
|
+
rules: {
|
|
328
|
+
// Preserve exact matches (case-sensitive)
|
|
329
|
+
leave: ["parseJSON", "autoIP", "getHTTPStatus"],
|
|
330
|
+
|
|
331
|
+
// Preserve patterns (case-insensitive)
|
|
332
|
+
leaveInsensitive: ["*xml*", "*html*"],
|
|
333
|
+
|
|
334
|
+
// Force uppercase transformations
|
|
335
|
+
upper: [
|
|
336
|
+
"api", // Exact: "api" â "API"
|
|
337
|
+
"http*", // Glob: "httpGet" â "HTTPGet"
|
|
338
|
+
"**url**", // Boundary: "buildUrlPath" â "buildURLPath"
|
|
339
|
+
"**json**" // Boundary: "parseJsonData" â "parseJSONData"
|
|
340
|
+
],
|
|
341
|
+
|
|
342
|
+
// Force lowercase transformations
|
|
343
|
+
lower: [
|
|
344
|
+
"id", // Exact: "ID" â "id"
|
|
345
|
+
"*id", // Glob: "userId" â "userid"
|
|
346
|
+
"uuid*" // Glob: "UUIDGenerator" â "uuidGenerator"
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
```
|
|
352
|
+
|
|
286
353
|
**Sanitize Pattern Types:**
|
|
287
354
|
|
|
288
355
|
- **Exact Match**: `"parseJSON"` - Matches exact string only
|
|
289
|
-
- **Glob Patterns**:
|
|
290
|
-
-
|
|
291
|
-
-
|
|
356
|
+
- **Glob Patterns**:
|
|
357
|
+
- `"*json*"` - Matches anywhere in string (`parseJsonData`)
|
|
358
|
+
- `"auto*"` - Matches at start (`autoGenerateId`)
|
|
359
|
+
- `"*id"` - Matches at end (`userId`)
|
|
360
|
+
- **Boundary Patterns**:
|
|
361
|
+
- `"**url**"` - Only matches when surrounded by characters (`buildUrlPath` â, `url` â)
|
|
362
|
+
- `"**json**"` - Matches `parseJsonData` but not standalone `json`
|
|
363
|
+
- **Case Control**:
|
|
364
|
+
- `leave` - Case-sensitive exact preservation
|
|
365
|
+
- `leaveInsensitive` - Case-insensitive preservation
|
|
366
|
+
- `preserveAllUpper`/`preserveAllLower` - Automatic case detection
|
|
367
|
+
|
|
368
|
+
**Advanced Pattern Examples:**
|
|
369
|
+
|
|
370
|
+
```javascript
|
|
371
|
+
// File transformations with patterns:
|
|
372
|
+
sanitizePathName("build-url-with-params", {
|
|
373
|
+
rules: { upper: ["**url**"] }
|
|
374
|
+
}); // â "buildURLWithParams"
|
|
375
|
+
|
|
376
|
+
sanitizePathName("parse-json-data", {
|
|
377
|
+
rules: { upper: ["**json**"] }
|
|
378
|
+
}); // â "parseJSONData"
|
|
379
|
+
|
|
380
|
+
sanitizePathName("get-http-status", {
|
|
381
|
+
rules: { upper: ["http*"] }
|
|
382
|
+
}); // â "getHTTPStatus"
|
|
383
|
+
|
|
384
|
+
sanitizePathName("validate-user-id", {
|
|
385
|
+
rules: { lower: ["*id"] }
|
|
386
|
+
}); // â "validateUserid"
|
|
387
|
+
|
|
388
|
+
sanitizePathName("XML_PARSER", {
|
|
389
|
+
preserveAllUpper: true
|
|
390
|
+
}); // â "XML_PARSER" (preserved)
|
|
391
|
+
```
|
|
292
392
|
|
|
293
393
|
### Multiple Instances
|
|
294
394
|
|
|
@@ -323,7 +423,7 @@ console.log(api2.context.tenant); // "bob"
|
|
|
323
423
|
```
|
|
324
424
|
|
|
325
425
|
> [!NOTE]
|
|
326
|
-
> **v2.x Simplification**: Unlike v1.x which required query string parameters or `withInstanceId()` methods, v2.x automatically creates isolated instances with each `slothlet()` call,
|
|
426
|
+
> **v2.x Simplification**: Unlike v1.x which required query string parameters or `withInstanceId()` methods, v2.x automatically creates isolated instances with each `slothlet()` call, using your chosen runtime system (`async` or `live`) for complete context separation.
|
|
327
427
|
|
|
328
428
|
---
|
|
329
429
|
|
|
@@ -345,20 +445,21 @@ Creates and loads an API instance with the specified configuration.
|
|
|
345
445
|
|
|
346
446
|
**Options:**
|
|
347
447
|
|
|
348
|
-
| Option | Type | Default | Description
|
|
349
|
-
| ----------- | --------- | ------------- |
|
|
350
|
-
| `dir` | `string` | `"api"` | Directory to load API modules from. Can be absolute or relative path. If relative, resolved from process.cwd().
|
|
351
|
-
| `lazy` | `boolean` | `false` | **Legacy** loading strategy - `true` for lazy loading (on-demand), `false` for eager loading (immediate). Use `mode` option instead.
|
|
352
|
-
| `mode` | `string` | - | **New** loading mode - `"lazy"` for on-demand loading, `"eager"` for immediate loading. Takes precedence over `lazy` option. Also supports execution modes for backward compatibility.
|
|
353
|
-
| `engine` | `string` | `"singleton"` | **New** execution environment mode - `"singleton"`, `"vm"`, `"worker"`, or `"fork"`
|
|
354
|
-
| `
|
|
355
|
-
| `
|
|
356
|
-
| `
|
|
357
|
-
| `
|
|
358
|
-
| `
|
|
359
|
-
| `
|
|
360
|
-
|
|
361
|
-
|
|
448
|
+
| Option | Type | Default | Description |
|
|
449
|
+
| ----------- | --------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
450
|
+
| `dir` | `string` | `"api"` | Directory to load API modules from. Can be absolute or relative path. If relative, resolved from process.cwd(). |
|
|
451
|
+
| `lazy` | `boolean` | `false` | **Legacy** loading strategy - `true` for lazy loading (on-demand), `false` for eager loading (immediate). Use `mode` option instead. |
|
|
452
|
+
| `mode` | `string` | - | **New** loading mode - `"lazy"` for on-demand loading, `"eager"` for immediate loading. Takes precedence over `lazy` option. Also supports execution modes for backward compatibility. |
|
|
453
|
+
| `engine` | `string` | `"singleton"` | **New** execution environment mode - `"singleton"`, `"vm"`, `"worker"`, or `"fork"` |
|
|
454
|
+
| `runtime` | `string` | `"async"` | Runtime binding system: `"async"` for AsyncLocalStorage-based context isolation (default, requires Node.js v16.4.0+), `"live"` for advanced live-binding system (works on Node.js v12.20.0+). Both provide full live-binding capabilities. |
|
|
455
|
+
| `apiDepth` | `number` | `Infinity` | Directory traversal depth control - `0` for root only, `Infinity` for all levels |
|
|
456
|
+
| `debug` | `boolean` | `false` | Enable verbose logging. Can also be set via `--slothletdebug` command line flag or `SLOTHLET_DEBUG=true` environment variable |
|
|
457
|
+
| `api_mode` | `string` | `"auto"` | API structure behavior when root-level default functions exist:<br/>âĒ `"auto"`: Automatically detects if root has default function export and creates callable API<br/>âĒ `"function"`: Forces API to be callable (use when you have root-level default function exports)<br/>âĒ `"object"`: Forces API to be object-only (use when you want object interface regardless of exports) |
|
|
458
|
+
| `context` | `object` | `{}` | Context data object injected into live-binding `context` reference. Available to all loaded modules via `import { context } from "@cldmv/slothlet/runtime"` |
|
|
459
|
+
| `reference` | `object` | `{}` | Reference object merged into the API root level. Properties not conflicting with loaded modules are added directly to the API |
|
|
460
|
+
| `sanitize` | `object` | `{}` | **ð§ NEW**: Advanced filename-to-API transformation control. Options: `lowerFirst` (boolean), `preserveAllUpper` (boolean), `preserveAllLower` (boolean), `rules` object with `leave` (exact case-sensitive), `leaveInsensitive` (case-insensitive), `upper`/`lower` arrays. Supports exact matches, glob patterns (`*json*`, `http*`), and boundary patterns (`**url**` for surrounded matches only) |
|
|
461
|
+
|
|
462
|
+
#### âĻ Current Option Format
|
|
362
463
|
|
|
363
464
|
The option structure has been improved for better clarity:
|
|
364
465
|
|
|
@@ -839,16 +940,16 @@ flowchart TD
|
|
|
839
940
|
HASDEFAULT -->|Yes| NAMESPACE
|
|
840
941
|
|
|
841
942
|
HASDEFAULT -->|No| NAMEDONLY{Only Named Exports?}
|
|
842
|
-
NAMEDONLY -->|Yes| FLATTEN[Flatten All Named Exports<br/>api.connect
|
|
943
|
+
NAMEDONLY -->|Yes| FLATTEN["Flatten All Named Exports<br/>api.connect, api.disconnect"]
|
|
843
944
|
|
|
844
945
|
NAMEDONLY -->|No| SINGLENAMED{Single Named Export<br/>Matching Filename?}
|
|
845
946
|
SINGLENAMED -->|Yes| FLATTENSINGLE[Flatten Single Export<br/>api.math]
|
|
846
947
|
SINGLENAMED -->|No| NAMESPACE
|
|
847
948
|
|
|
848
|
-
style FLATTEN fill:#e1f5fe
|
|
849
|
-
style FLATTENSINGLE fill:#e8f5e8
|
|
850
|
-
style NAMESPACE fill:#fff3e0
|
|
851
|
-
style PRESERVE fill:#fce4ec
|
|
949
|
+
style FLATTEN fill:#e1f5fe,stroke:#0277bd,stroke-width:2px,color:#000
|
|
950
|
+
style FLATTENSINGLE fill:#e8f5e8,stroke:#2e7d32,stroke-width:2px,color:#000
|
|
951
|
+
style NAMESPACE fill:#fff3e0,stroke:#e65100,stroke-width:2px,color:#000
|
|
952
|
+
style PRESERVE fill:#fce4ec,stroke:#c2185b,stroke-width:2px,color:#000
|
|
852
953
|
```
|
|
853
954
|
|
|
854
955
|
### ð Benefits of Smart Flattening
|
|
@@ -1049,7 +1150,7 @@ const syncResult = await api.string.format("Hello"); // Originally sync, but nee
|
|
|
1049
1150
|
## ðĄ Error Handling
|
|
1050
1151
|
|
|
1051
1152
|
> [!NOTE]
|
|
1052
|
-
> **Current Error Behavior**: Slothlet currently uses standard JavaScript error handling. Enhanced error handling with module suggestions is planned for
|
|
1153
|
+
> **Current Error Behavior**: Slothlet currently uses standard JavaScript error handling. Enhanced error handling with module suggestions is planned for v3.0.0 but not yet implemented.
|
|
1053
1154
|
|
|
1054
1155
|
**Current behavior:**
|
|
1055
1156
|
|
|
@@ -1062,7 +1163,7 @@ try {
|
|
|
1062
1163
|
}
|
|
1063
1164
|
```
|
|
1064
1165
|
|
|
1065
|
-
**Planned Enhanced Error Features (
|
|
1166
|
+
**Planned Enhanced Error Features (v3.0.0):**
|
|
1066
1167
|
|
|
1067
1168
|
> [!TIP]
|
|
1068
1169
|
> **Coming Soon**: Enhanced error handling with descriptive messages and module suggestions:
|
|
@@ -1123,7 +1224,7 @@ try {
|
|
|
1123
1224
|
2. **Configuration**: New options (`api_mode`, `context`, `reference`)
|
|
1124
1225
|
3. **Function names**: Enhanced preservation of original capitalization
|
|
1125
1226
|
4. **Module structure**: Mixed ESM/CJS support
|
|
1126
|
-
5. **Live bindings**:
|
|
1227
|
+
5. **Live bindings**: Dual runtime system with AsyncLocalStorage and live-bindings options
|
|
1127
1228
|
|
|
1128
1229
|
### Migration Steps
|
|
1129
1230
|
|
|
@@ -1234,7 +1335,7 @@ Apache-2.0 ÂĐ Shinrai / CLDMV
|
|
|
1234
1335
|
|
|
1235
1336
|
Slothlet v2.0 represents a complete architectural rewrite with enterprise-grade features and performance. Special thanks to all contributors who made this comprehensive enhancement possible.
|
|
1236
1337
|
|
|
1237
|
-
**ð Welcome to the future of module loading with Slothlet
|
|
1338
|
+
**ð Welcome to the future of module loading with Slothlet!**
|
|
1238
1339
|
|
|
1239
1340
|
> _Where sophisticated architecture meets blazing performance - slothlet is anything but slow._
|
|
1240
1341
|
|
|
@@ -64,6 +64,23 @@ function runtime_shouldWrapMethod(value, prop) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
|
|
67
|
+
function runtime_shouldExcludeFromProxy(val) {
|
|
68
|
+
if (val == null || typeof val !== "object") {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
for (const cls of EXCLUDED_INSTANCEOF_CLASSES) {
|
|
75
|
+
if (typeof cls === "function" && val instanceof cls) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
67
84
|
function runtime_isClassInstance(val) {
|
|
68
85
|
if (
|
|
69
86
|
val == null ||
|
|
@@ -144,6 +161,13 @@ export const makeWrapper = (ctx) => {
|
|
|
144
161
|
if (val == null || (typeof val !== "object" && typeof val !== "function")) return val;
|
|
145
162
|
if (cache.has(val)) return cache.get(val);
|
|
146
163
|
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
if (runtime_shouldExcludeFromProxy(val)) {
|
|
167
|
+
cache.set(val, val);
|
|
168
|
+
return val;
|
|
169
|
+
}
|
|
170
|
+
|
|
147
171
|
const proxied = new Proxy(val, {
|
|
148
172
|
apply(target, thisArg, args) {
|
|
149
173
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cldmv/slothlet",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.3",
|
|
4
4
|
"moduleVersions": {
|
|
5
5
|
"lazy": "1.3.0",
|
|
6
6
|
"eager": "1.3.0"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"import": "./devcheck.mjs"
|
|
20
20
|
},
|
|
21
21
|
"./slothlet": {
|
|
22
|
-
"
|
|
22
|
+
"slothlet-dev": {
|
|
23
23
|
"types": "./types/src/slothlet.d.mts",
|
|
24
24
|
"import": "./src/slothlet.mjs"
|
|
25
25
|
},
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"import": "./dist/slothlet.mjs"
|
|
28
28
|
},
|
|
29
29
|
"./runtime": {
|
|
30
|
-
"
|
|
30
|
+
"slothlet-dev": {
|
|
31
31
|
"types": "./types/src/lib/runtime/runtime.d.mts",
|
|
32
32
|
"import": "./src/lib/runtime/runtime.mjs"
|
|
33
33
|
},
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"import": "./dist/lib/runtime/runtime.mjs"
|
|
36
36
|
},
|
|
37
37
|
"./runtime/async": {
|
|
38
|
-
"
|
|
38
|
+
"slothlet-dev": {
|
|
39
39
|
"types": "./types/src/lib/runtime/runtime-asynclocalstorage.d.mts",
|
|
40
40
|
"import": "./src/lib/runtime/runtime-asynclocalstorage.mjs"
|
|
41
41
|
},
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"import": "./dist/lib/runtime/runtime-asynclocalstorage.mjs"
|
|
44
44
|
},
|
|
45
45
|
"./runtime/live": {
|
|
46
|
-
"
|
|
46
|
+
"slothlet-dev": {
|
|
47
47
|
"types": "./types/src/lib/runtime/runtime-livebindings.d.mts",
|
|
48
48
|
"import": "./src/lib/runtime/runtime-livebindings.mjs"
|
|
49
49
|
},
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"import": "./dist/lib/runtime/runtime-livebindings.mjs"
|
|
52
52
|
},
|
|
53
53
|
"./helpers/*": {
|
|
54
|
-
"
|
|
54
|
+
"slothlet-dev": {
|
|
55
55
|
"types": "./types/src/lib/helpers/*.d.mts",
|
|
56
56
|
"import": "./src/lib/helpers/*.mjs"
|
|
57
57
|
},
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"import": "./dist/lib/helpers/*.mjs"
|
|
60
60
|
},
|
|
61
61
|
"./modes/*": {
|
|
62
|
-
"
|
|
62
|
+
"slothlet-dev": {
|
|
63
63
|
"types": "./types/src/lib/modes/*.d.mts",
|
|
64
64
|
"import": "./src/lib/modes/*.mjs"
|
|
65
65
|
},
|
|
@@ -85,8 +85,9 @@
|
|
|
85
85
|
"test:performance-aggregated": "node tests/performance-benchmark-aggregated.mjs",
|
|
86
86
|
"lint": "eslint --config .configs/eslint.config.mjs .",
|
|
87
87
|
"build": "node tools/build-with-tests.mjs",
|
|
88
|
-
"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",
|
|
88
|
+
"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",
|
|
89
89
|
"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",
|
|
90
|
+
"ci:cleanup-src": "node tools/ci-cleanup-src.mjs",
|
|
90
91
|
"build:cleanup": "shx rm -rf types && shx rm -rf dist",
|
|
91
92
|
"build:dist": "shx mkdir -p dist && shx cp -r src/* dist/ && shx rm -rf dist/**/*.backup",
|
|
92
93
|
"build:types": "npx tsc -p .configs/tsconfig.dts.jsonc",
|
|
@@ -1 +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;
|
|
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;AAkN3C,iCAjBI,MAAM,YAuIhB;AAuSD;;;;;;;;;;;;;GAaG;AACH,mBATU,WAAS,MAAM,CAS6B;AAEtD;;;;;;;;;;;;;GAaG;AACH,sBATU,MAAM,CAS4C;AAE5D;;;;;;;;;;;;;GAaG;AACH,wBATU,MAAM,CASgD;;kCAnuB9B,kBAAkB"}
|
|
@@ -63,6 +63,13 @@ export type SlothletOptions = {
|
|
|
63
63
|
* - `"fork"`: Child process execution for complete isolation
|
|
64
64
|
*/
|
|
65
65
|
engine?: string;
|
|
66
|
+
/**
|
|
67
|
+
* - Runtime binding system:
|
|
68
|
+
* - `"async"` or `"asynclocalstorage"`: Use AsyncLocalStorage for context isolation (default, recommended)
|
|
69
|
+
* - `"live"` or `"livebindings"`: Use live binding system for dynamic context updates
|
|
70
|
+
* - Controls how `self`, `context`, and `reference` bindings are managed across function calls
|
|
71
|
+
*/
|
|
72
|
+
runtime?: string;
|
|
66
73
|
/**
|
|
67
74
|
* - Directory traversal depth control:
|
|
68
75
|
* - `Infinity`: Traverse all subdirectories recursively (default)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slothlet.d.mts","sourceRoot":"","sources":["../../dist/slothlet.mjs"],"names":[],"mappings":"AA++CA;;;;;;;;;GASG;AACH,kDARW,WAAS,MAAM,UACf,WAAS,MAAM,QAwCzB;AAr2CD;;;;;;;GAOG;AACH,mBAJU,MAAM,CAIO;AAEvB;;;;;GAKG;AACH,sBAJU,MAAM,CAIU;AAE1B;;;;;GAKG;AACH,wBAJU,MAAM,CAIY;;;;;;;;;UAw1Cd,MAAM;;;;;;WAIN,OAAO;;;;;;;;WAGP,MAAM;;;;;;;;aAKN,MAAM;;;;;;;
|
|
1
|
+
{"version":3,"file":"slothlet.d.mts","sourceRoot":"","sources":["../../dist/slothlet.mjs"],"names":[],"mappings":"AA++CA;;;;;;;;;GASG;AACH,kDARW,WAAS,MAAM,UACf,WAAS,MAAM,QAwCzB;AAr2CD;;;;;;;GAOG;AACH,mBAJU,MAAM,CAIO;AAEvB;;;;;GAKG;AACH,sBAJU,MAAM,CAIU;AAE1B;;;;;GAKG;AACH,wBAJU,MAAM,CAIY;;;;;;;;;UAw1Cd,MAAM;;;;;;WAIN,OAAO;;;;;;;;WAGP,MAAM;;;;;;;;aAKN,MAAM;;;;;;;cAKN,MAAM;;;;;;;eAIN,MAAM;;;;;;;;YAIN,OAAO;;;;;;;eAKP,MAAM;;;;;;cAIN,MAAM;;;;;;gBAGN,MAAM;;;;;;eAMjB;QAA8B,UAAU,GAA7B,OAAO;QACY,gBAAgB,GAAnC,OAAO;QACY,gBAAgB,GAAnC,OAAO;QACW,KAAK,GAClC;YAAqC,KAAK,GAA/B,MAAM,EAAE;YACkB,gBAAgB,GAA1C,MAAM,EAAE;YACkB,KAAK,GAA/B,MAAM,EAAE;YACkB,KAAK,GAA/B,MAAM,EAAE;SACrB;KAAA;;AAz4CD;;;;;;;;GAQG;AACH,mCAJW,eAAe,GACb,OAAO,CAAC,WAAS,MAAM,CAAC,CAiCpC"}
|