@stacksjs/utils 0.74.32 → 0.74.34
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 +11 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/pipe.d.ts +52 -0
- package/dist/pipe.js +1 -0
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -15,9 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
Stacks is a rapid development framework, where the goal is to _help you_ create & maintain frontends, backends, and clouds—without having to worry about the boilerplate. _An all-in-one toolkit that meets all your full stack needs._
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
<a href="https://stacksjs.com/docs/diagrams/stacks-runtime">
|
|
19
|
+
<picture>
|
|
20
|
+
<source media="(prefers-color-scheme: dark)" srcset="./docs/public/diagrams/stacks-runtime/dark.png">
|
|
21
|
+
<img alt="Stacks runtime architecture: developer to Buddy CLI to Stacks Cloud, and web or desktop client through rpx to stx, router, actions, ORM, and database" src="./docs/public/diagrams/stacks-runtime/light.png">
|
|
22
|
+
</picture>
|
|
23
|
+
</a>
|
|
19
24
|
|
|
20
|
-
|
|
25
|
+
_[Open the interactive diagram](https://stacksjs.com/docs/diagrams/stacks-runtime) for a theme toggle and SVG, PNG, JPEG, and WebP exports._
|
|
21
26
|
|
|
22
27
|
- Web & Desktop Applications _(including system tray apps)_
|
|
23
28
|
- Serverless & Traditional APIs
|
|
@@ -61,6 +66,8 @@ panx @stacksjs/buddy new my-project
|
|
|
61
66
|
|
|
62
67
|
Pantry executes Buddy in an isolated environment and provisions the generated project's declared toolchain during setup.
|
|
63
68
|
|
|
69
|
+
From there: the [documentation](https://stacksjs.com/docs/guide/intro), the [Buddy command reference](https://stacksjs.com/docs/guide/buddy/commands), and the [agent skills](https://stacksjs.com/docs/skills) that teach Claude Code, Codex, and Cursor how each subsystem works.
|
|
70
|
+
|
|
64
71
|
For frontend experiments in the browser, open the live stx starter:
|
|
65
72
|
|
|
66
73
|
[](https://stackblitz.com/fork/github/stacksjs/stackblitz?title=Stacks%20Starter)
|
|
@@ -78,7 +85,7 @@ buddy make:action UpdateUser # scaffold a new Action (also: model, view, job,
|
|
|
78
85
|
buddy --help # show every available command
|
|
79
86
|
```
|
|
80
87
|
|
|
81
|
-
For the full command reference, see the collapsible section below or the [Buddy CLI documentation](https://stacksjs.com/docs/
|
|
88
|
+
For the full command reference, see the collapsible section below or the [Buddy CLI documentation](https://stacksjs.com/docs/guide/buddy/commands).
|
|
82
89
|
|
|
83
90
|
<details>
|
|
84
91
|
<summary>View the complete Buddy Toolkit</summary>
|
|
@@ -245,7 +252,7 @@ buddy test:types # runs typecheck
|
|
|
245
252
|
|
|
246
253
|
</details>
|
|
247
254
|
|
|
248
|
-
Read more about the Buddy CLI in the [official docs](https://stacksjs.com/docs/
|
|
255
|
+
Read more about the Buddy CLI in the [official docs](https://stacksjs.com/docs/guide/buddy/commands): every command, every flag, every prompt explained.
|
|
249
256
|
|
|
250
257
|
## Features
|
|
251
258
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./clean";export*from"./config";export*from"./equal";export*from"./errors";export*from"./export-size";export*from"./find";export*from"./git";export*from"./hash";export*from"./helpers";export*from"./macroable";export*from"./safe-json";export*from"./versions";export* as browserUtils from"@stacksjs/browser";export{clamp,notNullish,retry,useOnline}from"@stacksjs/browser";export*from"./merge";export*from"./detect";export*from"./debounce";export*from"./bytes";export*from"./colors";export*from"./markdown";export*from"./size";export*from"./observer";export*from"./pipeline";
|
|
1
|
+
export*from"./clean";export*from"./config";export*from"./equal";export*from"./errors";export*from"./export-size";export*from"./find";export*from"./git";export*from"./hash";export*from"./helpers";export*from"./macroable";export*from"./safe-json";export*from"./versions";export* as browserUtils from"@stacksjs/browser";export{clamp,notNullish,retry,useOnline}from"@stacksjs/browser";export*from"./merge";export*from"./detect";export*from"./debounce";export*from"./bytes";export*from"./colors";export*from"./markdown";export*from"./size";export*from"./observer";export*from"./pipe";export*from"./pipeline";
|
package/dist/pipe.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export declare function pipe<A>(value: A): A;
|
|
2
|
+
export declare function pipe<A, B>(value: A, ab: (input: A) => B): B;
|
|
3
|
+
export declare function pipe<A, B, C>(value: A, ab: (input: A) => B, bc: (input: B) => C): C;
|
|
4
|
+
export declare function pipe<A, B, C, D>(value: A, ab: (input: A) => B, bc: (input: B) => C, cd: (input: C) => D): D;
|
|
5
|
+
export declare function pipe<A, B, C, D, E>(value: A, ab: (input: A) => B, bc: (input: B) => C, cd: (input: C) => D, de: (input: D) => E): E;
|
|
6
|
+
export declare function pipe<A, B, C, D, E, F>(value: A, ab: (input: A) => B, bc: (input: B) => C, cd: (input: C) => D, de: (input: D) => E, ef: (input: E) => F): F;
|
|
7
|
+
export declare function pipe<A, B, C, D, E, F, G>(value: A, ab: (input: A) => B, bc: (input: B) => C, cd: (input: C) => D, de: (input: D) => E, ef: (input: E) => F, fg: (input: F) => G): G;
|
|
8
|
+
export declare function pipe<A, B, C, D, E, F, G, H>(value: A, ab: (input: A) => B, bc: (input: B) => C, cd: (input: C) => D, de: (input: D) => E, ef: (input: E) => F, fg: (input: F) => G, gh: (input: G) => H): H;
|
|
9
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I>(value: A, ab: (input: A) => B, bc: (input: B) => C, cd: (input: C) => D, de: (input: D) => E, ef: (input: E) => F, fg: (input: F) => G, gh: (input: G) => H, hi: (input: H) => I): I;
|
|
10
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I, J>(value: A, ab: (input: A) => B, bc: (input: B) => C, cd: (input: C) => D, de: (input: D) => E, ef: (input: E) => F, fg: (input: F) => G, gh: (input: G) => H, hi: (input: H) => I, ij: (input: I) => J): J;
|
|
11
|
+
/**
|
|
12
|
+
* The same composition, without a value - a reusable function.
|
|
13
|
+
*
|
|
14
|
+
* `pipe` transforms something now; this builds the transformation to apply
|
|
15
|
+
* later, which is what makes it usable as a callback:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* const normalize = piped(
|
|
19
|
+
* (name: string) => name.trim(),
|
|
20
|
+
* name => name.toLowerCase(),
|
|
21
|
+
* )
|
|
22
|
+
*
|
|
23
|
+
* names.map(normalize)
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* The first step's parameter type is what the resulting function accepts, so it
|
|
27
|
+
* has to be annotated - there is nothing else for inference to work from.
|
|
28
|
+
*/
|
|
29
|
+
export declare function piped<A, B>(ab: (input: A) => B): (input: A) => B;
|
|
30
|
+
export declare function piped<A, B, C>(ab: (input: A) => B, bc: (input: B) => C): (input: A) => C;
|
|
31
|
+
export declare function piped<A, B, C, D>(ab: (input: A) => B, bc: (input: B) => C, cd: (input: C) => D): (input: A) => D;
|
|
32
|
+
export declare function piped<A, B, C, D, E>(ab: (input: A) => B, bc: (input: B) => C, cd: (input: C) => D, de: (input: D) => E): (input: A) => E;
|
|
33
|
+
export declare function piped<A, B, C, D, E, F>(ab: (input: A) => B, bc: (input: B) => C, cd: (input: C) => D, de: (input: D) => E, ef: (input: E) => F): (input: A) => F;
|
|
34
|
+
/**
|
|
35
|
+
* Run a side effect on a value and hand the value back.
|
|
36
|
+
*
|
|
37
|
+
* For inspecting a pipeline without breaking it - the step that logs, or
|
|
38
|
+
* records a metric, and does not change what flows on:
|
|
39
|
+
*
|
|
40
|
+
* ```ts
|
|
41
|
+
* pipe(
|
|
42
|
+
* users,
|
|
43
|
+
* list => sortBy(list, u => u.score),
|
|
44
|
+
* tap(list => log.debug(`${list.length} users`)),
|
|
45
|
+
* list => take(list, 3),
|
|
46
|
+
* )
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* The effect's return value is discarded on purpose. A step that means to
|
|
50
|
+
* change the value should be an ordinary step, where the type says so.
|
|
51
|
+
*/
|
|
52
|
+
export declare function tap<T>(effect: (value: T) => unknown): (value: T) => T;
|
package/dist/pipe.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function runSteps(value,steps){let current=value;for(const step of steps)current=step(current);return current}export function pipe(value,...steps){return runSteps(value,steps)}export function piped(...steps){return(input)=>runSteps(input,steps)}export function tap(effect){return(value)=>{effect(value);return value}}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/utils",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.74.
|
|
5
|
+
"version": "0.74.34",
|
|
6
6
|
"description": "The Stacks helper functions.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -62,20 +62,20 @@
|
|
|
62
62
|
"size": "bun scripts/export-size.ts"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@stacksjs/browser": "0.74.
|
|
66
|
-
"@stacksjs/cli": "0.74.
|
|
67
|
-
"@stacksjs/config": "0.74.
|
|
68
|
-
"@stacksjs/enums": "0.74.
|
|
69
|
-
"@stacksjs/error-handling": "0.74.
|
|
70
|
-
"@stacksjs/logging": "0.74.
|
|
71
|
-
"@stacksjs/path": "0.74.
|
|
72
|
-
"@stacksjs/storage": "0.74.
|
|
73
|
-
"@stacksjs/strings": "0.74.
|
|
74
|
-
"@stacksjs/types": "0.74.
|
|
65
|
+
"@stacksjs/browser": "0.74.34",
|
|
66
|
+
"@stacksjs/cli": "0.74.34",
|
|
67
|
+
"@stacksjs/config": "0.74.34",
|
|
68
|
+
"@stacksjs/enums": "0.74.34",
|
|
69
|
+
"@stacksjs/error-handling": "0.74.34",
|
|
70
|
+
"@stacksjs/logging": "0.74.34",
|
|
71
|
+
"@stacksjs/path": "0.74.34",
|
|
72
|
+
"@stacksjs/storage": "0.74.34",
|
|
73
|
+
"@stacksjs/strings": "0.74.34",
|
|
74
|
+
"@stacksjs/types": "0.74.34"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@stacksjs/arrays": "0.74.
|
|
78
|
-
"@stacksjs/lint": "0.74.
|
|
77
|
+
"@stacksjs/arrays": "0.74.34",
|
|
78
|
+
"@stacksjs/lint": "0.74.34",
|
|
79
79
|
"better-dx": "^0.2.24",
|
|
80
80
|
"filesize": "^11.0.22",
|
|
81
81
|
"markdown-table": "^3.0.4"
|