@routecraft/prettier-plugin-routecraft 0.6.0-canary.20 → 0.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 +20 -19
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,32 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
Prettier plugin that keeps Routecraft DSL chains compact and readable.
|
|
4
4
|
|
|
5
|
-
Prettier's defaults push fluent sub-
|
|
6
|
-
an extra level of indentation for every
|
|
7
|
-
`.
|
|
8
|
-
the threaded parameter stays on the arrow line and the
|
|
9
|
-
indent level.
|
|
5
|
+
Prettier's defaults push fluent sub-pipeline path closures onto their own line
|
|
6
|
+
and add an extra level of indentation for every `(b) => b...` branch builder
|
|
7
|
+
inside `.choice()` and `.multicast()`. This plugin overrides Prettier's printer
|
|
8
|
+
for those closures so the threaded parameter stays on the arrow line and the
|
|
9
|
+
chain keeps a single indent level.
|
|
10
10
|
|
|
11
11
|
## Before and after
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
14
|
// Prettier default
|
|
15
|
-
.choice(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
.otherwise((b) => b),
|
|
15
|
+
.choice(
|
|
16
|
+
when(senderInAllowlist(env.MAIL_ALLOWED_INBOUND), (b) =>
|
|
17
|
+
b
|
|
18
|
+
.enrich(agent("zoe"), only((r) => r, "agent"))
|
|
19
|
+
.to(mail({ action: "move" })),
|
|
20
|
+
),
|
|
21
|
+
otherwise((b) => b),
|
|
23
22
|
)
|
|
24
23
|
|
|
25
24
|
// With @routecraft/prettier-plugin-routecraft
|
|
26
|
-
.choice(
|
|
27
|
-
|
|
25
|
+
.choice(
|
|
26
|
+
when(senderInAllowlist(env.MAIL_ALLOWED_INBOUND), (b) => b
|
|
28
27
|
.enrich(agent("zoe"), only((r) => r, "agent"))
|
|
29
|
-
.to(mail({ action: "move" })))
|
|
30
|
-
|
|
28
|
+
.to(mail({ action: "move" }))),
|
|
29
|
+
otherwise((b) => b),
|
|
30
|
+
)
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
## Installation
|
|
@@ -76,8 +76,9 @@ bunx prettier --write .
|
|
|
76
76
|
The plugin only changes parameter-threaded builders: single-parameter arrow
|
|
77
77
|
closures whose body is a fluent chain rooted in that parameter, passed directly
|
|
78
78
|
as a call argument inside a `craft()` chain. Arrows such as
|
|
79
|
-
`(
|
|
80
|
-
|
|
79
|
+
`(b) => b.enrich(...).to(...)` (a branch builder inside `when(...)` /
|
|
80
|
+
`otherwise(...)` / `multicast(...)`) keep the parameter on the arrow line
|
|
81
|
+
instead of breaking the body onto its own line.
|
|
81
82
|
|
|
82
83
|
Everything else is left to Prettier's defaults, including factory-rooted
|
|
83
84
|
callbacks such as `(ex) => direct(...).send(...)` (whose chain is rooted in a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routecraft/prettier-plugin-routecraft",
|
|
3
|
-
"version": "0.6.0
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Prettier plugin for compact Routecraft DSL formatting",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "tsup
|
|
12
|
+
"build": "tsup",
|
|
13
13
|
"prepublishOnly": "bun run build",
|
|
14
14
|
"test": "vitest"
|
|
15
15
|
},
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"prettier": ">=3"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"prettier": "^3.
|
|
20
|
+
"prettier": "^3.9.6",
|
|
21
21
|
"tsup": "^8.5.1",
|
|
22
22
|
"typescript": "^5.9.3",
|
|
23
|
-
"vitest": "^4.1.
|
|
23
|
+
"vitest": "^4.1.10"
|
|
24
24
|
},
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"access": "public"
|