likec4 1.59.3 → 1.60.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/__app__/codegen/react.mjs +6 -6
- package/__app__/codegen/webcomponent.mjs +147 -69
- package/__app__/src/aichat/index.mjs +10 -5
- package/__app__/src/chunks/AIChat.mjs +1134 -693
- package/__app__/src/chunks/LikeC4Styles.mjs +4101 -1737
- package/__app__/src/chunks/ProjectsOverview.mjs +624 -334
- package/__app__/src/chunks/es.mjs +515 -335
- package/__app__/src/chunks/hooks.mjs +578 -366
- package/__app__/src/chunks/libs/@floating-ui.mjs +2720 -1966
- package/__app__/src/chunks/libs/@mantine.mjs +14067 -9487
- package/__app__/src/chunks/libs/@tanstack-ai.mjs +2266 -1146
- package/__app__/src/chunks/libs/@tanstack.mjs +3152 -1932
- package/__app__/src/chunks/libs/@xstate/react.mjs +2924 -1468
- package/__app__/src/chunks/libs/@xyflow/react.mjs +6627 -4067
- package/__app__/src/chunks/libs/bezier-js.mjs +1312 -726
- package/__app__/src/chunks/libs/d3.mjs +3218 -1509
- package/__app__/src/chunks/libs/fast-equals.mjs +437 -201
- package/__app__/src/chunks/libs/framer.mjs +9251 -3846
- package/__app__/src/chunks/libs/nanostores.mjs +174 -0
- package/__app__/src/chunks/libs/zod.mjs +4591 -2363
- package/__app__/src/chunks/rolldown-runtime.mjs +39 -23
- package/__app__/src/chunks/styled-system.mjs +3538 -756
- package/__app__/src/fonts.css +112 -1
- package/__app__/src/main.mjs +44398 -24039
- package/__app__/src/style.css +18488 -1
- package/config/schema.json +136 -97
- package/dist/app/render-view-client.css +1 -1
- package/dist/app/render-view-client.js +506 -338
- package/dist/chunks/enableServer.mjs +1 -1
- package/dist/chunks/filenames.mjs +16 -14
- package/dist/chunks/generate-likec4.mjs +5 -0
- package/dist/chunks/index.d.mts +246 -180
- package/dist/chunks/index2.d.mts +2882 -1977
- package/dist/chunks/libs/@chevrotain/gast.mjs +27 -1
- package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +81 -9
- package/dist/chunks/libs/@chevrotain/types.d.mts +111 -0
- package/dist/chunks/libs/@logtape/logtape.mjs +5 -4
- package/dist/chunks/libs/@lume/kiwi.mjs +1 -1
- package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -1
- package/dist/chunks/libs/birpc.mjs +1 -1
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
- package/dist/chunks/libs/chevrotain.mjs +87 -35
- package/dist/chunks/libs/eventemitter3.mjs +1 -1
- package/dist/chunks/libs/json5.mjs +4 -4
- package/dist/chunks/libs/langium.d.mts +9903 -5297
- package/dist/chunks/libs/langium.mjs +16 -24
- package/dist/chunks/libs/merge-error-cause.mjs +1 -1
- package/dist/chunks/libs/p-limit.mjs +1 -0
- package/dist/chunks/libs/p-queue.mjs +1 -1
- package/dist/chunks/libs/package-manager-detector.mjs +1 -1
- package/dist/chunks/libs/pako.mjs +2 -2
- package/dist/chunks/libs/pretty-ms.mjs +1 -1
- package/dist/chunks/libs/remeda.mjs +1 -1
- package/dist/chunks/libs/ufo.mjs +1 -1
- package/dist/chunks/libs/unstorage.mjs +1 -1
- package/dist/chunks/libs/which.mjs +1 -1
- package/dist/chunks/node.mjs +60 -60
- package/dist/chunks/rolldown-runtime.mjs +1 -1
- package/dist/chunks/sequence-view.mjs +1 -1
- package/dist/chunks/vite-plugin.mjs +55 -52
- package/dist/cli/index.d.mts +1 -1
- package/dist/cli/index.mjs +208 -1300
- package/dist/config/index.d.mts +2 -2
- package/dist/generators/likec4.d.mts +6578 -0
- package/dist/generators/likec4.mjs +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/model/index.d.mts +8 -5
- package/dist/vite-plugin/index.d.mts +6 -3
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +9 -0
- package/dist/vite-plugin/internal/index.d.mts +16 -15
- package/dist/vite-plugin/internal/index.mjs +144 -46
- package/generators/likec4/package.json +4 -0
- package/package.json +117 -110
- package/react/index.d.mts +8500 -5399
- package/react/index.mjs +534 -58617
- package/react/rolldown-runtime-DnkiqaRY.js +1 -0
- package/skills/likec4-dsl/SKILL.md +428 -0
- package/skills/likec4-dsl/evals/evals-public.json +202 -0
- package/skills/likec4-dsl/evals/grading-spec.json +589 -0
- package/skills/likec4-dsl/references/bridge-leanix-drawio.md +42 -0
- package/skills/likec4-dsl/references/cli.md +139 -0
- package/skills/likec4-dsl/references/configuration.md +266 -0
- package/skills/likec4-dsl/references/deployment.md +160 -0
- package/skills/likec4-dsl/references/dynamic-views.md +455 -0
- package/skills/likec4-dsl/references/examples.md +370 -0
- package/skills/likec4-dsl/references/identifier-validity.md +90 -0
- package/skills/likec4-dsl/references/include-predicates-wildcards.md +179 -0
- package/skills/likec4-dsl/references/model.md +151 -0
- package/skills/likec4-dsl/references/predicates.md +123 -0
- package/skills/likec4-dsl/references/relationships-bidirectional.md +176 -0
- package/skills/likec4-dsl/references/specification.md +75 -0
- package/skills/likec4-dsl/references/style-tokens-colors.md +150 -0
- package/skills/likec4-dsl/references/troubleshooting.md +96 -0
- package/skills/likec4-dsl/references/views.md +329 -0
- package/vite-plugin-modules.d.ts +4 -2
- package/dist/chunks/libs/picomatch.mjs +0 -1
- package/dist/chunks/libs/zod.d.mts +0 -2140
- package/dist/chunks/libs/zod.mjs +0 -65
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Common Mistakes & Debugging (LikeC4 DSL)
|
|
2
|
+
|
|
3
|
+
Load this file when encountering validation errors, unexpected rendering, or when an eval answer is failing.
|
|
4
|
+
|
|
5
|
+
## Syntax Errors
|
|
6
|
+
|
|
7
|
+
| Error | Cause | Fix |
|
|
8
|
+
|-------|-------|-----|
|
|
9
|
+
| "Identifier PAYMENT.API not found" | Dots in identifier name | Use `payment-api` not `payment.api`; dots are FQN separators only |
|
|
10
|
+
| "Unknown kind SERVICE" | Kind not in specification | Define `element service { ... }` in the specification block |
|
|
11
|
+
| "Duplicate FQN cloud.backend" | Element ID repeated under the same parent | Rename one element; each sibling must have a unique identifier |
|
|
12
|
+
| "Expected property TYPE after include *" | Malformed filter predicate | Use `include * where kind is component`, not `include * component` |
|
|
13
|
+
| "Invalid relationship kind async-cache" | Kind not found in specification | Define `relationship async-cache { ... }` in specification first |
|
|
14
|
+
|
|
15
|
+
## Model & Hierarchy
|
|
16
|
+
|
|
17
|
+
| Error | Cause | Fix |
|
|
18
|
+
|-------|-------|-----|
|
|
19
|
+
| Element shows but relationships don't render | Relationship references FQN incorrectly | Use exact FQN matching the model hierarchy |
|
|
20
|
+
| "Can't define relationship from parent to child" | Direct parent-child relationships are forbidden | Move the relationship outside the parent element or use implicit notation |
|
|
21
|
+
| Child element not visible from other files | Referencing by short name instead of FQN | Import or use full FQN: `cloud.backend.api` |
|
|
22
|
+
| Extend block adds duplicate tags | Tags stack on merge | Use consistent tag names; duplicates are not deduplicated automatically |
|
|
23
|
+
|
|
24
|
+
## View Predicates
|
|
25
|
+
|
|
26
|
+
| Error | Cause | Fix |
|
|
27
|
+
|-------|-------|-----|
|
|
28
|
+
| `include *` shows grandchildren | Confusing `*` with `**` | `*` = direct children only; use `**` for recursive descent |
|
|
29
|
+
| Relationships disappear in scoped view | Neighbors not explicitly included | Add `include -> scope` or `include <-> scope` to pull in inbound/outbound sources |
|
|
30
|
+
| "WHERE predicate not matching any elements" | Tag or kind name is case-sensitive | Use exact case: `#Critical` ≠ `#critical` |
|
|
31
|
+
| Element included but styled differently | Global vs. local style conflict | Local view styles override global; audit style rules order in the view block |
|
|
32
|
+
|
|
33
|
+
## Deployment
|
|
34
|
+
|
|
35
|
+
| Error | Cause | Fix |
|
|
36
|
+
|-------|-------|-----|
|
|
37
|
+
| `instanceOf` doesn't resolve | Instance refers to wrong FQN | Use the exact logical model FQN, not the deployment node identifier |
|
|
38
|
+
| "Undefined DEPLOYMENT_KIND" | Kind referenced but not in specification | Define `deploymentNode vm { ... }` in specification |
|
|
39
|
+
| Deployment relationship inherits unexpectedly | Logical model edges are inherited automatically | Suppress inherited relationships explicitly in the deployment view if unwanted |
|
|
40
|
+
|
|
41
|
+
## Dynamic Views
|
|
42
|
+
|
|
43
|
+
| Error | Cause | Fix |
|
|
44
|
+
|-------|-------|-----|
|
|
45
|
+
| `Nested parallel blocks are not allowed` | Nested `parallel { parallel { ... } }` (or `par`) | Flatten: put all concurrent steps in a single `parallel { }` block. Other flow blocks (`opt`/`loop`/`try`/`alt`) may nest freely |
|
|
46
|
+
| `"loop" can not be used as an alternative branch` | Non-branch block (`loop`/`opt`/`parallel`/`try`) placed directly inside `alt` | `alt` accepts only `when`/`if`/`else` branches; nest the block inside a branch |
|
|
47
|
+
| `"when" alternative branch must be inside "alt"` | `when`/`if`/`else` used at top level or inside a non-`alt` block | Wrap the branches in an `alt { ... }` block |
|
|
48
|
+
| `catch`/`finally` rejected | `catch` without a preceding `try`, or `catch` after `finally` | Keep order `try` → `catch?` → `finally?` |
|
|
49
|
+
| Response arrows (`<-`) show wrong direction | Chained `<-` steps are not supported | After `a -> b -> c`, write one `<-` step per hop: `b <- c`, then `a <- b`. `<-` cannot be chained (`a <- b <- c` is a parse error) |
|
|
50
|
+
| `navigateTo` link doesn't work | Target view name does not exist | Ensure the target view name exists in the same project; from a dynamic step it must be another `dynamic view` |
|
|
51
|
+
| `variant sequence` is ignored | Wrong keyword or spelling | Use exact: `variant sequence` (not `type`, `mode`, or `sequence` alone) |
|
|
52
|
+
|
|
53
|
+
## Validation & Import
|
|
54
|
+
|
|
55
|
+
| Most Common | Solution |
|
|
56
|
+
|---|---|
|
|
57
|
+
| `validate` reports config not found | Ensure `likec4.config.json` exists in the project root directory |
|
|
58
|
+
| `Imported project not found` | `import` takes another project's `name` (from its `likec4.config`), not a file path: `import { x } from 'other-project'`. Files of the same project need no import; reference elements by full FQN |
|
|
59
|
+
| Symbol from import invisible in model | Symbol must be public (defined at top level); nested elements need FQN |
|
|
60
|
+
| Large error count in project but your file is clean | Use `likec4 validate --json --no-layout --file <edited-file> <project-dir>` and check `filteredErrors`/`filteredFiles`; text mode can also print diagnostics from other workspace files before the filtered summary |
|
|
61
|
+
|
|
62
|
+
## Performance & Large Models
|
|
63
|
+
|
|
64
|
+
| Symptom | Cause | Action |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| Validation takes >30s | Specification changes trigger full project re-parse | Keep specification in a separate file; avoid editing it frequently |
|
|
67
|
+
| Export generates a partial PNG | Layout engine timeout on complex view | Split large views with `navigateTo` or reduce the element count |
|
|
68
|
+
| IDE responsiveness slow | Too many open files or large specification in working file | Split into `spec.c4` + `model.c4` + `views.c4` |
|
|
69
|
+
|
|
70
|
+
## Debugging Workflow
|
|
71
|
+
|
|
72
|
+
When encountering errors, follow these steps in order:
|
|
73
|
+
|
|
74
|
+
1. **Run validation with `--file` and check `filteredErrors`:**
|
|
75
|
+
```bash
|
|
76
|
+
likec4 validate --json --no-layout --file <your-file> <project-dir>
|
|
77
|
+
```
|
|
78
|
+
If `filteredErrors` = 0 but `totalErrors` > 0, your file is clean; the error is in an upstream file.
|
|
79
|
+
|
|
80
|
+
2. **Check FQN integrity:** Find the identifier from the error message and verify it matches the model hierarchy exactly.
|
|
81
|
+
|
|
82
|
+
3. **Isolate predicate issues:** Copy the failing `include`/`exclude` rule into a new minimal test view to confirm predicate semantics in isolation.
|
|
83
|
+
|
|
84
|
+
4. **Validate specification first:** Comment out `model`, `deployment`, and `views`; validate the `specification` block alone. If it passes, uncomment the next block and repeat.
|
|
85
|
+
|
|
86
|
+
5. **Use `extend` strategically:** When enriching elements across files, use `extend FQN { }` rather than re-declaring — re-declarations cause duplicate FQN errors.
|
|
87
|
+
|
|
88
|
+
## Skill Best Practices
|
|
89
|
+
|
|
90
|
+
1. **Always start with project structure understanding.** Use the `understand-project-structure` skill before making changes to an unfamiliar project.
|
|
91
|
+
2. **For relationship ambiguity, always include KIND + TITLE.** When source/target/kind match multiple relationships, include title in the matcher to avoid silently targeting the wrong one.
|
|
92
|
+
3. **Response discipline on strict prompts.** Output one final answer first (no alternatives) when the prompt says "exact", "minimal", or "paste-ready".
|
|
93
|
+
4. **Validate after each file edit.** Always run `likec4 validate --json --no-layout --file <edited-file> <project-dir>` after changes; use `--file` to focus on your changes only.
|
|
94
|
+
5. **Cross-file references use FQN.** Never assume short names resolve across file boundaries; they don't.
|
|
95
|
+
6. **Keep specification stable.** Changes invalidate the entire model parse; prefer a separate `spec.c4` file and minimize changes to it.
|
|
96
|
+
7. **Test wildcard semantics locally.** When unsure whether `*` or `**` is correct, create a minimal test view to confirm behavior before committing.
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
# Views
|
|
2
|
+
|
|
3
|
+
Three types of views are supported:
|
|
4
|
+
|
|
5
|
+
1. Element views - projections of the model, based on predicates
|
|
6
|
+
2. Dynamic views - step-by-step sequence of interactions between elements
|
|
7
|
+
3. Deployment views - projections of the deployment model, based on predicates
|
|
8
|
+
|
|
9
|
+
View IDENTIFIER must be unique within the project, available across all files. Duplicate identifiers will result in a validation error.
|
|
10
|
+
There is special view - `index`, if not defined, it will be automatically created to include all top-level elements.
|
|
11
|
+
|
|
12
|
+
Syntax:
|
|
13
|
+
|
|
14
|
+
```likec4
|
|
15
|
+
views {
|
|
16
|
+
|
|
17
|
+
LOCAL_STYLE_RULES // optional style rules, applied to all views in this block
|
|
18
|
+
|
|
19
|
+
// element view
|
|
20
|
+
view IDENTIFIER {
|
|
21
|
+
TAGS // optional tags, must come first if present, before any properties
|
|
22
|
+
PROPERTIES // optional, but must come before any view rules
|
|
23
|
+
ELEMENT_VIEW_RULES
|
|
24
|
+
}
|
|
25
|
+
// element view can also be scoped to a specific element, explained below
|
|
26
|
+
view IDENTIFIER of ELEMENT_ID {
|
|
27
|
+
TAGS
|
|
28
|
+
PROPERTIES
|
|
29
|
+
ELEMENT_VIEW_RULES
|
|
30
|
+
}
|
|
31
|
+
// dynamic views
|
|
32
|
+
dynamic view IDENTIFIER {
|
|
33
|
+
TAGS
|
|
34
|
+
PROPERTIES
|
|
35
|
+
DYNAMIC_VIEW_RULES
|
|
36
|
+
}
|
|
37
|
+
// deployment views
|
|
38
|
+
deployment view IDENTIFIER {
|
|
39
|
+
TAGS
|
|
40
|
+
PROPERTIES
|
|
41
|
+
DEPLOYMENT_VIEW_RULES
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Element View Rules
|
|
47
|
+
|
|
48
|
+
Syntax:
|
|
49
|
+
|
|
50
|
+
```likec4
|
|
51
|
+
include PREDICATE, PREDICATE, ...
|
|
52
|
+
exclude PREDICATE, PREDICATE, ...
|
|
53
|
+
style ELEMENT_EXPRESSION, ... {
|
|
54
|
+
// Apply style properties to elements matching the expressions
|
|
55
|
+
}
|
|
56
|
+
global style STYLE_GROUP_IDENTIFIER
|
|
57
|
+
autoLayout TopBottom|BottomTop|LeftRight|RightLeft [rankSep] [nodeSep] [spline|ortho]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
See [Predicates](./predicates.md) for more information on predicates and expressions.
|
|
61
|
+
|
|
62
|
+
**Important:**
|
|
63
|
+
|
|
64
|
+
- Rules order matters, as every next rule applies on top of the previous, accumulating result.
|
|
65
|
+
- `exclude` only removes elements that were included by previous rules.
|
|
66
|
+
- `style` rules override previously applied styles.
|
|
67
|
+
- Style cascade (each override the previous): Spec defaults → element properties → local styles → view-level styles → customized predicates
|
|
68
|
+
|
|
69
|
+
## Edge routing
|
|
70
|
+
|
|
71
|
+
To draw relationships with right-angle bends, set `routing ortho` in a view:
|
|
72
|
+
|
|
73
|
+
```likec4
|
|
74
|
+
view {
|
|
75
|
+
routing ortho
|
|
76
|
+
include *
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Use `spline` for curved relationships or `ortho` for horizontal and vertical segments. The default is `spline`. Routing applies to element, dynamic, and deployment views. Sequence diagrams ignore this setting.
|
|
81
|
+
|
|
82
|
+
LikeC4 uses the first value defined in this precedence order:
|
|
83
|
+
|
|
84
|
+
1. The view's `routing` property.
|
|
85
|
+
2. The last `autoLayout` rule's routing parameter.
|
|
86
|
+
3. The project default, `styles.defaults.view.routing`.
|
|
87
|
+
4. The built-in default, `spline`.
|
|
88
|
+
|
|
89
|
+
If both the view property and `autoLayout` set routing, the property takes precedence and the language server reports a warning. Changing routing alone preserves saved node positions and control points without invalidating the layout.
|
|
90
|
+
|
|
91
|
+
Graphviz can route relationships through unrelated group boxes or place parallel routes close together. To reduce crowding, show fewer relationships or edit individual connections. Increasing `autoLayout` spacing gives nodes more room, but doesn't guarantee separation between routes.
|
|
92
|
+
|
|
93
|
+
Edited edges that share a straight segment move onto separate tracks where space at their endpoints permits. Unedited Graphviz routes keep their positions. Automatic label placement avoids nodes, other labels, and routes where space permits; dense views can still contain overlaps.
|
|
94
|
+
|
|
95
|
+
## Dynamic View Rules
|
|
96
|
+
|
|
97
|
+
Syntax:
|
|
98
|
+
|
|
99
|
+
```text
|
|
100
|
+
STEP ::=
|
|
101
|
+
SOURCE -> TARGET [LABEL] // forward message
|
|
102
|
+
| SOURCE <- TARGET [LABEL] // backward message
|
|
103
|
+
[{
|
|
104
|
+
RELATIONSHIP_PROPERTIES
|
|
105
|
+
RELATIONSHIP_STYLE_PROPERTIES
|
|
106
|
+
}]
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
DYNAMIC_VIEW_STYLE_RULE ::=
|
|
110
|
+
style EXPRESSION, ... {
|
|
111
|
+
// Apply style properties to elements matching the expressions
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
DYNAMIC_VIEW_RULES ::=
|
|
116
|
+
STEP
|
|
117
|
+
STEP
|
|
118
|
+
DYNAMIC_VIEW_STYLE_RULE
|
|
119
|
+
...
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Local Style Rules
|
|
123
|
+
|
|
124
|
+
Styles placed inside `views {}` but outside any `view {}` apply to all views in that block:
|
|
125
|
+
|
|
126
|
+
```likec4
|
|
127
|
+
views {
|
|
128
|
+
// This style applies to ALL views in this block
|
|
129
|
+
style * { color green }
|
|
130
|
+
|
|
131
|
+
view view1 {
|
|
132
|
+
include * // All elements are green
|
|
133
|
+
}
|
|
134
|
+
view index {
|
|
135
|
+
include *
|
|
136
|
+
style backend { color red } // All elements are green, except backend which is red
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Global Style Groups
|
|
142
|
+
|
|
143
|
+
Reusable style groups defined in `global { ... }`:
|
|
144
|
+
|
|
145
|
+
Syntax:
|
|
146
|
+
|
|
147
|
+
```likec4
|
|
148
|
+
global {
|
|
149
|
+
styleGroup GROUP_IDENTIFIER {
|
|
150
|
+
style EXPRESSION { ... }
|
|
151
|
+
style EXPRESSION { ... }
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
views {
|
|
156
|
+
view index {
|
|
157
|
+
global style GROUP_IDENTIFIER
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
```likec4
|
|
163
|
+
global {
|
|
164
|
+
styleGroup brandColors {
|
|
165
|
+
style * { color primary }
|
|
166
|
+
style element.tag = #deprecated { color muted; opacity 30% }
|
|
167
|
+
style element.tag = #critical { color red; border dashed }
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
views {
|
|
172
|
+
view index {
|
|
173
|
+
include *
|
|
174
|
+
global style brandColors // Apply the style group
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Style groups can contain multiple `style` rules. They are applied in the order defined within the group. When used in a view, global styles sit between local styles and view-level styles in the cascade.
|
|
180
|
+
|
|
181
|
+
# Dynamic Views — Detailed Reference
|
|
182
|
+
|
|
183
|
+
## Steps
|
|
184
|
+
|
|
185
|
+
Each step represents an interaction between two elements:
|
|
186
|
+
|
|
187
|
+
```likec4
|
|
188
|
+
// Forward step
|
|
189
|
+
customer -> frontend "opens app"
|
|
190
|
+
|
|
191
|
+
// Backward step (response/return flow)
|
|
192
|
+
frontend <- backend "returns data"
|
|
193
|
+
|
|
194
|
+
// Step with full properties
|
|
195
|
+
customer -> frontend "places order" {
|
|
196
|
+
title "Customer places an order" // Override step label
|
|
197
|
+
description "Detailed description"
|
|
198
|
+
technology "HTTPS"
|
|
199
|
+
notes '''
|
|
200
|
+
Additional notes displayed in sidebar.
|
|
201
|
+
Supports **Markdown** formatting.
|
|
202
|
+
'''
|
|
203
|
+
color red
|
|
204
|
+
navigateTo order-detail // Link to another dynamic view
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Step properties: `title`, `description`, `technology`, `notes`, `navigateTo`, all relationship properties.
|
|
209
|
+
|
|
210
|
+
### Chained Steps
|
|
211
|
+
|
|
212
|
+
Steps can be chained to reduce repetition:
|
|
213
|
+
|
|
214
|
+
```likec4
|
|
215
|
+
customer
|
|
216
|
+
-> frontend "opens" // Read as "customer opens frontend"
|
|
217
|
+
-> backend "requests" // Read as "frontend requests backend"
|
|
218
|
+
-> database "queries" // Read as "backend queries database"
|
|
219
|
+
<- backend "responds" // Read as "database responds to backend"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Each arrow in the chain creates a separate step. The target of the previous step becomes the source of the next.
|
|
223
|
+
|
|
224
|
+
## Parallel Steps
|
|
225
|
+
|
|
226
|
+
Use `parallel` (or `par`) blocks for concurrent interactions:
|
|
227
|
+
|
|
228
|
+
```likec4
|
|
229
|
+
dynamic view flow {
|
|
230
|
+
frontend -> backend "requests data"
|
|
231
|
+
|
|
232
|
+
parallel {
|
|
233
|
+
backend -> cache "checks cache"
|
|
234
|
+
backend -> database "queries DB"
|
|
235
|
+
backend -> external-api "fetches enrichment"
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
backend -> frontend "returns aggregated data"
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Parallel blocks can be mixed with sequential steps, but cannot be nested inside another `parallel`/`par` block (`Nested parallel blocks are not allowed`).
|
|
243
|
+
|
|
244
|
+
## Variants
|
|
245
|
+
|
|
246
|
+
| Variant | Rendering | Use case |
|
|
247
|
+
| ------------------- | ----------------------------- | ---------------------------------- |
|
|
248
|
+
| `diagram` (default) | Animated box-and-line diagram | General flow visualization |
|
|
249
|
+
| `sequence` | UML sequence diagram | API call sequences, protocol flows |
|
|
250
|
+
|
|
251
|
+
### Using `variant sequence`
|
|
252
|
+
|
|
253
|
+
The `variant sequence` keyword renders the dynamic view as a UML sequence diagram. This is especially useful for API call sequences and protocol flows.
|
|
254
|
+
|
|
255
|
+
**Key syntax points:**
|
|
256
|
+
|
|
257
|
+
- Use `variant sequence` at the start of the dynamic view block
|
|
258
|
+
- Use `->` for forward/call direction
|
|
259
|
+
- Use `<-` for backward/return direction (not `->` with different semantics)
|
|
260
|
+
- Sequence diagrams work best with leaf elements (not containers)
|
|
261
|
+
|
|
262
|
+
```likec4
|
|
263
|
+
dynamic view api-sequence {
|
|
264
|
+
variant sequence
|
|
265
|
+
|
|
266
|
+
client -> gateway "POST /orders"
|
|
267
|
+
gateway -> auth "validate token"
|
|
268
|
+
auth <- gateway "200 OK"
|
|
269
|
+
gateway -> orders "create order"
|
|
270
|
+
orders -> db "INSERT"
|
|
271
|
+
orders <- db "order_id"
|
|
272
|
+
gateway <- orders "201 Created"
|
|
273
|
+
client <- gateway "201 Created"
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**Common mistake:** Using `->` for returns instead of `<-`. The arrow direction indicates message flow:
|
|
278
|
+
|
|
279
|
+
- `a -> b` means "a sends to b" (request/call)
|
|
280
|
+
- `a <- b` means "b sends to a" (response/return)
|
|
281
|
+
|
|
282
|
+
```likec4
|
|
283
|
+
// ❌ WRONG - using -> for returns
|
|
284
|
+
dynamic view wrong {
|
|
285
|
+
variant sequence
|
|
286
|
+
client -> gateway "request"
|
|
287
|
+
gateway -> client "response" // This renders incorrectly!
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// ✅ CORRECT - using <- for returns
|
|
291
|
+
dynamic view correct {
|
|
292
|
+
variant sequence
|
|
293
|
+
client -> gateway "request"
|
|
294
|
+
client <- gateway "response" // Proper return flow
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Include in Dynamic Views
|
|
299
|
+
|
|
300
|
+
Dynamic views support element-view predicates for context elements that do not participate in steps. Predicates do not generate or filter the step sequence itself.
|
|
301
|
+
|
|
302
|
+
```likec4
|
|
303
|
+
dynamic view flow {
|
|
304
|
+
customer -> frontend "opens"
|
|
305
|
+
frontend -> backend "requests"
|
|
306
|
+
|
|
307
|
+
// Add parent containers as visual context
|
|
308
|
+
include cloud with {
|
|
309
|
+
color muted
|
|
310
|
+
opacity 10%
|
|
311
|
+
}
|
|
312
|
+
include amazon
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Styling in Dynamic Views
|
|
317
|
+
|
|
318
|
+
Same styling rules as element views:
|
|
319
|
+
|
|
320
|
+
```likec4
|
|
321
|
+
dynamic view flow {
|
|
322
|
+
customer -> frontend "opens"
|
|
323
|
+
frontend -> backend "requests"
|
|
324
|
+
|
|
325
|
+
style customer { color green }
|
|
326
|
+
style * { size sm }
|
|
327
|
+
style frontend { color muted }
|
|
328
|
+
}
|
|
329
|
+
```
|
package/vite-plugin-modules.d.ts
CHANGED
|
@@ -6,16 +6,18 @@
|
|
|
6
6
|
// Portions of this file have been modified by NVIDIA CORPORATION & AFFILIATES.
|
|
7
7
|
|
|
8
8
|
declare module 'likec4:projects' {
|
|
9
|
-
import type { WebappExportFormat } from 'likec4/config'
|
|
9
|
+
import type { RelationshipBrowserScope, WebappExportFormat } from 'likec4/config'
|
|
10
10
|
import type { ProjectId } from 'likec4/model'
|
|
11
11
|
type LandingPageConfig =
|
|
12
12
|
| { redirect: true }
|
|
13
13
|
| { include: string[] }
|
|
14
14
|
| { exclude: string[] }
|
|
15
|
-
|
|
15
|
+
export interface Project {
|
|
16
16
|
id: ProjectId
|
|
17
17
|
title?: string
|
|
18
|
+
path: string
|
|
18
19
|
landingPage?: LandingPageConfig
|
|
20
|
+
relationshipBrowserDefaultScope: RelationshipBrowserScope
|
|
19
21
|
exportFormats: readonly WebappExportFormat[]
|
|
20
22
|
}
|
|
21
23
|
export const isSingleProject: boolean
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"../rolldown-runtime.mjs";var t=e(((e,t)=>{let n=`[^\\\\/]`,r=`[^/]`,i=`(?:\\/|$)`,a=`(?:^|\\/)`,o=`\\.{1,2}${i}`,s={DOT_LITERAL:`\\.`,PLUS_LITERAL:`\\+`,QMARK_LITERAL:`\\?`,SLASH_LITERAL:`\\/`,ONE_CHAR:`(?=.)`,QMARK:r,END_ANCHOR:i,DOTS_SLASH:o,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!${a}${o})`,NO_DOT_SLASH:`(?!\\.{0,1}${i})`,NO_DOTS_SLASH:`(?!${o})`,QMARK_NO_DOT:`[^.\\/]`,STAR:`${r}*?`,START_ANCHOR:a,SEP:`/`},c={...s,SLASH_LITERAL:`[\\\\/]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`\\.{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!\\.{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!\\.{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:`[^.\\\\/]`,START_ANCHOR:`(?:^|[\\\\/])`,END_ANCHOR:`(?:[\\\\/]|$)`,SEP:`\\`};t.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{__proto__:null,alnum:`a-zA-Z0-9`,alpha:`a-zA-Z`,ascii:`\\x00-\\x7F`,blank:` \\t`,cntrl:`\\x00-\\x1F\\x7F`,digit:`0-9`,graph:`\\x21-\\x7E`,lower:`a-z`,print:`\\x20-\\x7E `,punct:`\\-!"#$%&'()\\*+,./:;<=>?@[\\]^_\`{|}~`,space:` \\t\\r\\n\\v\\f`,upper:`A-Z`,word:`A-Za-z0-9_`,xdigit:`A-Fa-f0-9`},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":`*`,"**/**":`**`,"**/**/**":`**`},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:`negate`,open:`(?:(?!(?:`,close:`))${e.STAR})`},"?":{type:`qmark`,open:`(?:`,close:`)?`},"+":{type:`plus`,open:`(?:`,close:`)+`},"*":{type:`star`,open:`(?:`,close:`)*`},"@":{type:`at`,open:`(?:`,close:`)`}}},globChars(e){return e===!0?c:s}}})),n=e((e=>{let{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:r,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:a}=t();e.isObject=e=>typeof e==`object`&&!!e&&!Array.isArray(e),e.hasRegexChars=e=>i.test(e),e.isRegexChar=t=>t.length===1&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(a,`\\$1`),e.toPosixSlashes=e=>e.replace(n,`/`),e.isWindows=()=>{if(typeof navigator<`u`&&navigator.platform){let e=navigator.platform.toLowerCase();return e===`win32`||e===`windows`}return typeof process<`u`&&process.platform?process.platform===`win32`:!1},e.removeBackslashes=e=>e.replace(r,e=>e===`\\`?``:e),e.escapeLast=(t,n,r)=>{let i=t.lastIndexOf(n,r);return i===-1?t:t[i-1]===`\\`?e.escapeLast(t,n,i-1):`${t.slice(0,i)}\\${t.slice(i)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith(`./`)&&(n=n.slice(2),t.prefix=`./`),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?``:`^`}(?:${e})${n.contains?``:`$`}`;return t.negated===!0&&(r=`(?:^(?!${r}).*$)`),r},e.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:`/`),r=n[n.length-1];return r===``?n[n.length-2]:r}})),r=e(((e,r)=>{let i=n(),{CHAR_ASTERISK:a,CHAR_AT:o,CHAR_BACKWARD_SLASH:s,CHAR_COMMA:c,CHAR_DOT:l,CHAR_EXCLAMATION_MARK:u,CHAR_FORWARD_SLASH:d,CHAR_LEFT_CURLY_BRACE:f,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:m,CHAR_PLUS:h,CHAR_QUESTION_MARK:g,CHAR_RIGHT_CURLY_BRACE:_,CHAR_RIGHT_PARENTHESES:v,CHAR_RIGHT_SQUARE_BRACKET:y}=t(),isPathSeparator=e=>e===d||e===s,depth=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)},scan=(e,t)=>{let n=t||{},r=e.length-1,b=n.parts===!0||n.tokens===!0||n.scanToEnd===!0,x=[],S=[],C=[],w=e,T=-1,E=0,D=0,O=!1,k=!1,A=!1,j=!1,M=!1,N=!1,P=!1,F=!1,I=!1,L=!1,R=0,z,B,V={value:``,depth:0,isGlob:!1},eos=()=>T>=r,peek=()=>w.charCodeAt(T+1),advance=()=>(z=B,w.charCodeAt(++T));for(;T<r;){B=advance();let e;if(B===s){P=V.backslashes=!0,B=advance(),B===f&&(N=!0);continue}if(N===!0||B===f){for(R++;eos()!==!0&&(B=advance());){if(B===s){P=V.backslashes=!0,advance();continue}if(B===f){R++;continue}if(N!==!0&&B===l&&(B=advance())===l){if(O=V.isBrace=!0,A=V.isGlob=!0,L=!0,b===!0)continue;break}if(N!==!0&&B===c){if(O=V.isBrace=!0,A=V.isGlob=!0,L=!0,b===!0)continue;break}if(B===_&&(R--,R===0)){N=!1,O=V.isBrace=!0,L=!0;break}}if(b===!0)continue;break}if(B===d){if(x.push(T),S.push(V),V={value:``,depth:0,isGlob:!1},L===!0)continue;if(z===l&&T===E+1){E+=2;continue}D=T+1;continue}if(n.noext!==!0&&(B===h||B===o||B===a||B===g||B===u)&&peek()===p){if(A=V.isGlob=!0,j=V.isExtglob=!0,L=!0,B===u&&T===E&&(I=!0),b===!0){let e=0;for(;eos()!==!0&&(B=advance());){if(B===s){P=V.backslashes=!0,advance();continue}if(B===p){e++;continue}if(B===v&&--e===0){L=!0;break}}continue}break}if(B===a){if(z===a&&(M=V.isGlobstar=!0),A=V.isGlob=!0,L=!0,b===!0)continue;break}if(B===g){if(A=V.isGlob=!0,L=!0,b===!0)continue;break}if(B===m){for(;eos()!==!0&&(e=advance());){if(e===s){P=V.backslashes=!0,advance();continue}if(e===y){k=V.isBracket=!0,A=V.isGlob=!0,L=!0;break}}if(b===!0)continue;break}if(n.nonegate!==!0&&B===u&&T===E){F=V.negated=!0,E++;continue}if(n.noparen!==!0&&B===p){if(A=V.isGlob=!0,b===!0){let e=1;for(;eos()!==!0&&(B=advance());){if(B===s){P=V.backslashes=!0,advance();continue}if(B===p){e++;continue}if(B===v&&--e===0){L=!0;break}}continue}break}if(A===!0){if(L=!0,b===!0)continue;break}}n.noext===!0&&(j=!1,A=!1);let H=w,U=``,W=``;E>0&&(U=w.slice(0,E),w=w.slice(E),D-=E),H&&A===!0&&D>0?(H=w.slice(0,D),W=w.slice(D)):A===!0?(H=``,W=w):H=w,H&&H!==``&&H!==`/`&&H!==w&&isPathSeparator(H.charCodeAt(H.length-1))&&(H=H.slice(0,-1)),n.unescape===!0&&(W&&=i.removeBackslashes(W),H&&P===!0&&(H=i.removeBackslashes(H)));let G={prefix:U,input:e,start:E,base:H,glob:W,isBrace:O,isBracket:k,isGlob:A,isExtglob:j,isGlobstar:M,negated:F,negatedExtglob:I};if(n.tokens===!0&&(G.maxDepth=0,isPathSeparator(B)||S.push(V),G.tokens=S),n.parts===!0||n.tokens===!0){let t;for(let r=0;r<x.length;r++){let i=t===void 0?E:t+1,a=x[r],o=e.slice(i,a);n.tokens&&(r===0&&E!==0?(S[r].isPrefix=!0,S[r].value=U):S[r].value=o,depth(S[r]),G.maxDepth+=S[r].depth),a>=E&&(C.push(o),t=a)}let r=t===void 0?E:t+1,i=e.slice(r);C.push(i),n.tokens&&t&&t+1<e.length&&(S[S.length-1].value=i,depth(S[S.length-1]),G.maxDepth+=S[S.length-1].depth),G.slashes=x,G.parts=C}return G};r.exports=scan})),i=e(((e,r)=>{let i=t(),a=n(),{MAX_LENGTH:o,POSIX_REGEX_SOURCE:s,REGEX_NON_SPECIAL_CHARS:c,REGEX_SPECIAL_CHARS_BACKREF:l,REPLACEMENTS:u}=i,expandRange=(e,t)=>{if(typeof t.expandRange==`function`)return t.expandRange(...e,t);e.sort();let n=`[${e.join(`-`)}]`;try{new RegExp(n)}catch{return e.map(e=>a.escapeRegex(e)).join(`..`)}return n},syntaxError=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,splitTopLevel=e=>{let t=[],n=0,r=0,i=0,a=``,o=!1;for(let s of e){if(o===!0){a+=s,o=!1;continue}if(s===`\\`){a+=s,o=!0;continue}if(s===`"`){i=i===1?0:1,a+=s;continue}if(i===0){if(s===`[`)n++;else if(s===`]`&&n>0)n--;else if(n===0){if(s===`(`)r++;else if(s===`)`&&r>0)r--;else if(s===`|`&&r===0){t.push(a),a=``;continue}}}a+=s}return t.push(a),t},isPlainBranch=e=>{let t=!1;for(let n of e){if(t===!0){t=!1;continue}if(n===`\\`){t=!0;continue}if(/[?*+@!()[\]{}]/.test(n))return!1}return!0},normalizeSimpleBranch=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(isPlainBranch(t))return t.replace(/\\(.)/g,`$1`)},hasRepeatedCharPrefixOverlap=e=>{let t=e.map(normalizeSimpleBranch).filter(Boolean);for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++){let r=t[e],i=t[n],a=r[0];if(!(!a||r!==a.repeat(r.length)||i!==a.repeat(i.length))&&(r===i||r.startsWith(i)||i.startsWith(r)))return!0}return!1},parseRepeatedExtglob=(e,t=!0)=>{if(e[0]!==`+`&&e[0]!==`*`||e[1]!==`(`)return;let n=0,r=0,i=0,a=!1;for(let o=1;o<e.length;o++){let s=e[o];if(a===!0){a=!1;continue}if(s===`\\`){a=!0;continue}if(s===`"`){i=i===1?0:1;continue}if(i!==1){if(s===`[`){n++;continue}if(s===`]`&&n>0){n--;continue}if(!(n>0)){if(s===`(`){r++;continue}if(s===`)`&&(r--,r===0))return t===!0&&o!==e.length-1?void 0:{type:e[0],body:e.slice(2,o),end:o}}}}},buildCharClassStar=e=>`${e.length===1?a.escapeRegex(e[0]):`[${e.map(e=>a.escapeRegex(e)).join(``)}]`}*`,getStarExtglobSequenceChars=e=>{let t=0,n=[];for(;t<e.length;){let r=parseRepeatedExtglob(e.slice(t),!1);if(!r||r.type!==`*`)return;let i=splitTopLevel(r.body).map(e=>e.trim());if(i.length!==1)return;let a=normalizeSimpleBranch(i[0]);if(!a||a.length!==1)return;n.push(a),t+=r.end+1}if(!(n.length<1))return n},repeatedExtglobRecursion=e=>{let t=0,n=e.trim(),r=parseRepeatedExtglob(n);for(;r;)t++,n=r.body.trim(),r=parseRepeatedExtglob(n);return t},analyzeRepeatedExtglob=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let n=typeof t.maxExtglobRecursion==`number`?t.maxExtglobRecursion:i.DEFAULT_MAX_EXTGLOB_RECURSION,r=splitTopLevel(e).map(e=>e.trim());if(r.length>1&&(r.some(e=>e===``)||r.some(e=>/^[*?]+$/.test(e))||hasRepeatedCharPrefixOverlap(r)))return{risky:!0};let a=[],o=!1,s=!0;for(let e of r){let t=getStarExtglobSequenceChars(e);if(t){o=!0,a.push(...t);continue}let r=normalizeSimpleBranch(e);if(r&&r.length===1){a.push(r);continue}if(s=!1,repeatedExtglobRecursion(e)>n)return{risky:!0}}return o?s?{risky:!0,safeOutput:buildCharClassStar([...new Set(a)])}:{risky:!0}:{risky:!1}},parse=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=u[e]||e;let n={...t},r=typeof n.maxLength==`number`?Math.min(o,n.maxLength):o,d=e.length;if(d>r)throw SyntaxError(`Input length: ${d}, exceeds maximum allowed length: ${r}`);let f={type:`bos`,value:``,output:n.prepend||``},p=[f],m=n.capture?``:`?:`,h=i.globChars(n.windows),g=i.extglobChars(h),{DOT_LITERAL:_,PLUS_LITERAL:v,SLASH_LITERAL:y,ONE_CHAR:b,DOTS_SLASH:x,NO_DOT:S,NO_DOT_SLASH:C,NO_DOTS_SLASH:w,QMARK:T,QMARK_NO_DOT:E,STAR:D,START_ANCHOR:O}=h,globstar=e=>`(${m}(?:(?!${O}${e.dot?x:_}).)*?)`,k=n.dot?``:S,A=n.dot?T:E,j=n.bash===!0?globstar(n):D;n.capture&&(j=`(${j})`),typeof n.noext==`boolean`&&(n.noextglob=n.noext);let M={input:e,index:-1,start:0,dot:n.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:p};e=a.removePrefix(e,M),d=e.length;let N=[],P=[],F=[],I=f,L,eos=()=>M.index===d-1,R=M.peek=(t=1)=>e[M.index+t],z=M.advance=()=>e[++M.index]||``,remaining=()=>e.slice(M.index+1),consume=(e=``,t=0)=>{M.consumed+=e,M.index+=t},append=e=>{M.output+=e.output==null?e.value:e.output,consume(e.value)},negate=()=>{let e=1;for(;R()===`!`&&(R(2)!==`(`||R(3)===`?`);)z(),M.start++,e++;return e%2!=0&&(M.negated=!0,M.start++,!0)},increment=e=>{M[e]++,F.push(e)},decrement=e=>{M[e]--,F.pop()},push=e=>{if(I.type===`globstar`){let t=M.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||N.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(M.output=M.output.slice(0,-I.output.length),I.type=`star`,I.value=`*`,I.output=j,M.output+=I.output)}if(N.length&&e.type!==`paren`&&(N[N.length-1].inner+=e.value),(e.value||e.output)&&append(e),I&&I.type===`text`&&e.type===`text`){I.output=(I.output||I.value)+e.value,I.value+=e.value;return}e.prev=I,p.push(e),I=e},extglobOpen=(e,t)=>{let r={...g[t],conditions:1,inner:``};r.prev=I,r.parens=M.parens,r.output=M.output,r.startIndex=M.index,r.tokensIndex=p.length;let i=(n.capture?`(`:``)+r.open;increment(`parens`),push({type:e,value:t,output:M.output?``:b}),push({type:`paren`,extglob:!0,value:z(),output:i}),N.push(r)},extglobClose=r=>{let i=e.slice(r.startIndex,M.index+1),o=e.slice(r.startIndex+2,M.index),s=analyzeRepeatedExtglob(o,n);if((r.type===`plus`||r.type===`star`)&&s.risky){let e=s.safeOutput?(r.output?``:b)+(n.capture?`(${s.safeOutput})`:s.safeOutput):void 0,t=p[r.tokensIndex];t.type=`text`,t.value=i,t.output=e||a.escapeRegex(i);for(let e=r.tokensIndex+1;e<p.length;e++)p[e].value=``,p[e].output=``,delete p[e].suffix;M.output=r.output+t.output,M.backtrack=!0,push({type:`paren`,extglob:!0,value:L,output:``}),decrement(`parens`);return}let c=r.close+(n.capture?`)`:``),l;if(r.type===`negate`){let e=j;r.inner&&r.inner.length>1&&r.inner.includes(`/`)&&(e=globstar(n)),(e!==j||eos()||/^\)+$/.test(remaining()))&&(c=r.close=`)$))${e}`),r.inner.includes(`*`)&&(l=remaining())&&/^\.[^\\/.]+$/.test(l)&&(c=r.close=`)${parse(l,{...t,fastpaths:!1}).output})${e})`),r.prev.type===`bos`&&(M.negatedExtglob=!0)}push({type:`paren`,extglob:!0,value:L,output:c}),decrement(`parens`)};if(n.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let r=!1,i=e.replace(l,(e,t,n,i,a,o)=>i===`\\`?(r=!0,e):i===`?`?t?t+i+(a?T.repeat(a.length):``):o===0?A+(a?T.repeat(a.length):``):T.repeat(n.length):i===`.`?_.repeat(n.length):i===`*`?t?t+i+(a?j:``):j:t?e:`\\${e}`);return r===!0&&(i=n.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&n.contains===!0?(M.output=e,M):(M.output=a.wrapOutput(i,M,t),M)}for(;!eos();){if(L=z(),L===`\0`)continue;if(L===`\\`){let e=R();if(e===`/`&&n.bash!==!0||e===`.`||e===`;`)continue;if(!e){L+=`\\`,push({type:`text`,value:L});continue}let t=/^\\+/.exec(remaining()),r=0;if(t&&t[0].length>2&&(r=t[0].length,M.index+=r,r%2!=0&&(L+=`\\`)),n.unescape===!0?L=z():L+=z(),M.brackets===0){push({type:`text`,value:L});continue}}if(M.brackets>0&&(L!==`]`||I.value===`[`||I.value===`[^`)){if(n.posix!==!1&&L===`:`){let e=I.value.slice(1);if(e.includes(`[`)&&(I.posix=!0,e.includes(`:`))){let e=I.value.lastIndexOf(`[`),t=I.value.slice(0,e),n=I.value.slice(e+2),r=s[n];if(r){I.value=t+r,M.backtrack=!0,z(),!f.output&&p.indexOf(I)===1&&(f.output=b);continue}}}(L===`[`&&R()!==`:`||L===`-`&&R()===`]`)&&(L=`\\${L}`),L===`]`&&(I.value===`[`||I.value===`[^`)&&(L=`\\${L}`),n.posix===!0&&L===`!`&&I.value===`[`&&(L=`^`),I.value+=L,append({value:L});continue}if(M.quotes===1&&L!==`"`){L=a.escapeRegex(L),I.value+=L,append({value:L});continue}if(L===`"`){M.quotes=M.quotes===1?0:1,n.keepQuotes===!0&&push({type:`text`,value:L});continue}if(L===`(`){increment(`parens`),push({type:`paren`,value:L});continue}if(L===`)`){if(M.parens===0&&n.strictBrackets===!0)throw SyntaxError(syntaxError(`opening`,`(`));let e=N[N.length-1];if(e&&M.parens===e.parens+1){extglobClose(N.pop());continue}push({type:`paren`,value:L,output:M.parens?`)`:`\\)`}),decrement(`parens`);continue}if(L===`[`){if(n.nobracket===!0||!remaining().includes(`]`)){if(n.nobracket!==!0&&n.strictBrackets===!0)throw SyntaxError(syntaxError(`closing`,`]`));L=`\\${L}`}else increment(`brackets`);push({type:`bracket`,value:L});continue}if(L===`]`){if(n.nobracket===!0||I&&I.type===`bracket`&&I.value.length===1){push({type:`text`,value:L,output:`\\${L}`});continue}if(M.brackets===0){if(n.strictBrackets===!0)throw SyntaxError(syntaxError(`opening`,`[`));push({type:`text`,value:L,output:`\\${L}`});continue}decrement(`brackets`);let e=I.value.slice(1);if(I.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(L=`/${L}`),I.value+=L,append({value:L}),n.literalBrackets===!1||a.hasRegexChars(e))continue;let t=a.escapeRegex(I.value);if(M.output=M.output.slice(0,-I.value.length),n.literalBrackets===!0){M.output+=t,I.value=t;continue}I.value=`(${m}${t}|${I.value})`,M.output+=I.value;continue}if(L===`{`&&n.nobrace!==!0){increment(`braces`);let e={type:`brace`,value:L,output:`(`,outputIndex:M.output.length,tokensIndex:M.tokens.length};P.push(e),push(e);continue}if(L===`}`){let e=P[P.length-1];if(n.nobrace===!0||!e){push({type:`text`,value:L,output:L});continue}let t=`)`;if(e.dots===!0){let e=p.slice(),r=[];for(let t=e.length-1;t>=0&&(p.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&r.unshift(e[t].value);t=expandRange(r,n),M.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=M.output.slice(0,e.outputIndex),r=M.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,L=t=`\\}`,M.output=n;for(let e of r)M.output+=e.output||e.value}push({type:`brace`,value:L,output:t}),decrement(`braces`),P.pop();continue}if(L===`|`){N.length>0&&N[N.length-1].conditions++,push({type:`text`,value:L});continue}if(L===`,`){let e=L,t=P[P.length-1];t&&F[F.length-1]===`braces`&&(t.comma=!0,e=`|`),push({type:`comma`,value:L,output:e});continue}if(L===`/`){if(I.type===`dot`&&M.index===M.start+1){M.start=M.index+1,M.consumed=``,M.output=``,p.pop(),I=f;continue}push({type:`slash`,value:L,output:y});continue}if(L===`.`){if(M.braces>0&&I.type===`dot`){I.value===`.`&&(I.output=_);let e=P[P.length-1];I.type=`dots`,I.output+=L,I.value+=L,e.dots=!0;continue}if(M.braces+M.parens===0&&I.type!==`bos`&&I.type!==`slash`){push({type:`text`,value:L,output:_});continue}push({type:`dot`,value:L,output:_});continue}if(L===`?`){if(!(I&&I.value===`(`)&&n.noextglob!==!0&&R()===`(`&&R(2)!==`?`){extglobOpen(`qmark`,L);continue}if(I&&I.type===`paren`){let e=R(),t=L;(I.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(remaining()))&&(t=`\\${L}`),push({type:`text`,value:L,output:t});continue}if(n.dot!==!0&&(I.type===`slash`||I.type===`bos`)){push({type:`qmark`,value:L,output:E});continue}push({type:`qmark`,value:L,output:T});continue}if(L===`!`){if(n.noextglob!==!0&&R()===`(`&&(R(2)!==`?`||!/[!=<:]/.test(R(3)))){extglobOpen(`negate`,L);continue}if(n.nonegate!==!0&&M.index===0){negate();continue}}if(L===`+`){if(n.noextglob!==!0&&R()===`(`&&R(2)!==`?`){extglobOpen(`plus`,L);continue}if(I&&I.value===`(`||n.regex===!1){push({type:`plus`,value:L,output:v});continue}if(I&&(I.type===`bracket`||I.type===`paren`||I.type===`brace`)||M.parens>0){push({type:`plus`,value:L});continue}push({type:`plus`,value:v});continue}if(L===`@`){if(n.noextglob!==!0&&R()===`(`&&R(2)!==`?`){push({type:`at`,extglob:!0,value:L,output:``});continue}push({type:`text`,value:L});continue}if(L!==`*`){(L===`$`||L===`^`)&&(L=`\\${L}`);let e=c.exec(remaining());e&&(L+=e[0],M.index+=e[0].length),push({type:`text`,value:L});continue}if(I&&(I.type===`globstar`||I.star===!0)){I.type=`star`,I.star=!0,I.value+=L,I.output=j,M.backtrack=!0,M.globstar=!0,consume(L);continue}let t=remaining();if(n.noextglob!==!0&&/^\([^?]/.test(t)){extglobOpen(`star`,L);continue}if(I.type===`star`){if(n.noglobstar===!0){consume(L);continue}let r=I.prev,i=r.prev,a=r.type===`slash`||r.type===`bos`,o=i&&(i.type===`star`||i.type===`globstar`);if(n.bash===!0&&(!a||t[0]&&t[0]!==`/`)){push({type:`star`,value:L,output:``});continue}let s=M.braces>0&&(r.type===`comma`||r.type===`brace`),c=N.length&&(r.type===`pipe`||r.type===`paren`);if(!a&&r.type!==`paren`&&!s&&!c){push({type:`star`,value:L,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[M.index+4];if(n&&n!==`/`)break;t=t.slice(3),consume(`/**`,3)}let l=eos()||M.parens>0&&t===`)`.repeat(M.parens)&&!N.some(e=>e.type===`negate`);if(r.type===`bos`&&eos()){I.type=`globstar`,I.value+=L,I.output=globstar(n),M.output=I.output,M.globstar=!0,consume(L);continue}if(r.type===`slash`&&r.prev.type!==`bos`&&!o&&l){M.output=M.output.slice(0,-(r.output+I.output).length),r.output=`(?:${r.output}`,I.type=`globstar`,I.output=globstar(n)+(n.strictSlashes?`)`:`|$)`),I.value+=L,M.globstar=!0,M.output+=r.output+I.output,consume(L);continue}if(r.type===`slash`&&r.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;M.output=M.output.slice(0,-(r.output+I.output).length),r.output=`(?:${r.output}`,I.type=`globstar`,I.output=`${globstar(n)}${y}|${y}${e})`,I.value+=L,M.output+=r.output+I.output,M.globstar=!0,consume(L+z()),push({type:`slash`,value:`/`,output:``});continue}if(r.type===`bos`&&t[0]===`/`){I.type=`globstar`,I.value+=L,I.output=`(?:^|${y}|${globstar(n)}${y})`,M.output=I.output,M.globstar=!0,consume(L+z()),push({type:`slash`,value:`/`,output:``});continue}M.output=M.output.slice(0,-I.output.length),I.type=`globstar`,I.output=globstar(n),I.value+=L,M.output+=I.output,M.globstar=!0,consume(L);continue}let r={type:`star`,value:L,output:j};if(n.bash===!0){r.output=`.*?`,(I.type===`bos`||I.type===`slash`)&&(r.output=k+r.output),push(r);continue}if(I&&(I.type===`bracket`||I.type===`paren`)&&n.regex===!0){r.output=L,push(r);continue}(M.index===M.start||I.type===`slash`||I.type===`dot`)&&(I.type===`dot`?(M.output+=C,I.output+=C):n.dot===!0?(M.output+=w,I.output+=w):(M.output+=k,I.output+=k),R()!==`*`&&(M.output+=b,I.output+=b)),push(r)}for(;M.brackets>0;){if(n.strictBrackets===!0)throw SyntaxError(syntaxError(`closing`,`]`));M.output=a.escapeLast(M.output,`[`),decrement(`brackets`)}for(;M.parens>0;){if(n.strictBrackets===!0)throw SyntaxError(syntaxError(`closing`,`)`));M.output=a.escapeLast(M.output,`(`),decrement(`parens`)}for(;M.braces>0;){if(n.strictBrackets===!0)throw SyntaxError(syntaxError(`closing`,`}`));M.output=a.escapeLast(M.output,`{`),decrement(`braces`)}if(n.strictSlashes!==!0&&(I.type===`star`||I.type===`bracket`)&&push({type:`maybe_slash`,value:``,output:`${y}?`}),M.backtrack===!0){M.output=``;for(let e of M.tokens)M.output+=e.output==null?e.value:e.output,e.suffix&&(M.output+=e.suffix)}return M};parse.fastpaths=(e,t)=>{let n={...t},r=typeof n.maxLength==`number`?Math.min(o,n.maxLength):o,s=e.length;if(s>r)throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${r}`);e=u[e]||e;let{DOT_LITERAL:c,SLASH_LITERAL:l,ONE_CHAR:d,DOTS_SLASH:f,NO_DOT:p,NO_DOTS:m,NO_DOTS_SLASH:h,STAR:g,START_ANCHOR:_}=i.globChars(n.windows),v=n.dot?m:p,y=n.dot?h:p,b=n.capture?``:`?:`,x={negated:!1,prefix:``},S=n.bash===!0?`.*?`:g;n.capture&&(S=`(${S})`);let globstar=e=>e.noglobstar===!0?S:`(${b}(?:(?!${_}${e.dot?f:c}).)*?)`,create=e=>{switch(e){case`*`:return`${v}${d}${S}`;case`.*`:return`${c}${d}${S}`;case`*.*`:return`${v}${S}${c}${d}${S}`;case`*/*`:return`${v}${S}${l}${d}${y}${S}`;case`**`:return v+globstar(n);case`**/*`:return`(?:${v}${globstar(n)}${l})?${y}${d}${S}`;case`**/*.*`:return`(?:${v}${globstar(n)}${l})?${y}${S}${c}${d}${S}`;case`**/.*`:return`(?:${v}${globstar(n)}${l})?${c}${d}${S}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=create(t[1]);return n?n+c+t[2]:void 0}}},C=create(a.removePrefix(e,x));return C&&n.strictSlashes!==!0&&(C+=`${l}?`),C},r.exports=parse})),a=e(((e,a)=>{let o=r(),s=i(),c=n(),l=t(),isObject=e=>e&&typeof e==`object`&&!Array.isArray(e),picomatch=(e,t,n=!1)=>{if(Array.isArray(e)){let r=e.map(e=>picomatch(e,t,n)),arrayMatcher=e=>{for(let t of r){let n=t(e);if(n)return n}return!1};return arrayMatcher}let r=isObject(e)&&e.tokens&&e.input;if(e===``||typeof e!=`string`&&!r)throw TypeError(`Expected pattern to be a non-empty string`);let i=t||{},a=i.windows,o=r?picomatch.compileRe(e,t):picomatch.makeRe(e,t,!1,!0),s=o.state;delete o.state;let isIgnored=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};isIgnored=picomatch(i.ignore,e,n)}let matcher=(n,r=!1)=>{let{isMatch:c,match:l,output:u}=picomatch.test(n,o,t,{glob:e,posix:a}),d={glob:e,state:s,regex:o,posix:a,input:n,output:u,match:l,isMatch:c};return typeof i.onResult==`function`&&i.onResult(d),c===!1?(d.isMatch=!1,r?d:!1):isIgnored(n)?(typeof i.onIgnore==`function`&&i.onIgnore(d),d.isMatch=!1,r?d:!1):(typeof i.onMatch==`function`&&i.onMatch(d),!r||d)};return n&&(matcher.state=s),matcher};picomatch.test=(e,t,n,{glob:r,posix:i}={})=>{if(typeof e!=`string`)throw TypeError(`Expected input to be a string`);if(e===``)return{isMatch:!1,output:``};let a=n||{},o=a.format||(i?c.toPosixSlashes:null),s=e===r,l=s&&o?o(e):e;return s===!1&&(l=o?o(e):e,s=l===r),(s===!1||a.capture===!0)&&(s=a.matchBase===!0||a.basename===!0?picomatch.matchBase(e,t,n,i):t.exec(l)),{isMatch:!!s,match:s,output:l}},picomatch.matchBase=(e,t,n,r=n&&n.windows)=>(t instanceof RegExp?t:picomatch.makeRe(t,n)).test(c.basename(e,{windows:r})),picomatch.isMatch=(e,t,n)=>picomatch(t,n)(e),picomatch.parse=(e,t)=>Array.isArray(e)?e.map(e=>picomatch.parse(e,t)):s(e,{...t,fastpaths:!1}),picomatch.scan=(e,t)=>o(e,t),picomatch.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let i=t||{},a=i.contains?``:`^`,o=i.contains?``:`$`,s=`${a}(?:${e.output})${o}`;e&&e.negated===!0&&(s=`^(?!${s}).*$`);let c=picomatch.toRegex(s,t);return r===!0&&(c.state=e),c},picomatch.makeRe=(e,t={},n=!1,r=!1)=>{if(!e||typeof e!=`string`)throw TypeError(`Expected a non-empty string`);let i={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]===`.`||e[0]===`*`)&&(i.output=s.fastpaths(e,t)),i.output||(i=s(e,t)),picomatch.compileRe(i,t,n,r)},picomatch.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?`i`:``))}catch(e){if(t&&t.debug===!0)throw e;return/$^/}},picomatch.constants=l,a.exports=picomatch})),o=e(((e,t)=>{let r=a(),i=n();function picomatch(e,t,n=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:i.isWindows()}),r(e,t,n)}Object.assign(picomatch,r),t.exports=picomatch}));export{o as t};
|