@manifesto-ai/compiler 5.0.0 → 5.0.1
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 +38 -27
- package/dist/analyzer/validator.d.ts +0 -1
- package/dist/chunk-C5V4IBWA.js +23 -0
- package/dist/{chunk-HOS3TLHW.js → chunk-FZGHNM7N.js} +1 -1
- package/dist/{chunk-A356Y7I6.js → chunk-ZYXA2NXJ.js} +1 -1
- package/dist/esbuild.js +1 -1
- package/dist/evaluation/evaluate-patch.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lexer/lexer.d.ts +0 -1
- package/dist/node-loader.js +1 -1
- package/dist/parser/precedence.d.ts +1 -1
- package/dist/rollup.js +1 -1
- package/dist/rspack.js +1 -1
- package/dist/vite.js +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +9 -9
- package/dist/chunk-JYNK3VUK.js +0 -23
package/README.md
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
# @manifesto-ai/compiler
|
|
2
2
|
|
|
3
|
-
> **Compiler**
|
|
3
|
+
> **Compiler** lets apps import MEL domains and can emit generated SDK domain facades.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## What is the Compiler?
|
|
8
8
|
|
|
9
|
-
The compiler is the MEL frontend for Manifesto.
|
|
9
|
+
The compiler is the MEL frontend for Manifesto. For app developers, it lets a
|
|
10
|
+
bundler import `.mel` files and optionally emit the generated
|
|
11
|
+
`<source>.domain.ts` facade used by `createManifesto<TDomain>()`.
|
|
10
12
|
|
|
13
|
+
```text
|
|
14
|
+
.mel source -> compiler plugin -> createManifesto()
|
|
15
|
+
-> optional generated <source>.domain.ts facade
|
|
11
16
|
```
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
|
|
18
|
+
Internally, the compiler tokenizes, parses, validates, and lowers MEL source
|
|
19
|
+
into the runtime schema consumed behind the SDK app path.
|
|
14
20
|
|
|
15
21
|
---
|
|
16
22
|
|
|
@@ -19,9 +25,10 @@ MEL source -> Compiler -> DomainSchema -> Core
|
|
|
19
25
|
| Responsibility | Description |
|
|
20
26
|
| --- | --- |
|
|
21
27
|
| Parse MEL | Tokenize and parse MEL into an AST |
|
|
22
|
-
| Validate | Scope, typing, and
|
|
23
|
-
|
|
|
24
|
-
|
|
|
28
|
+
| Validate | Scope, typing, and domain-rule checks aligned to the current compiler contract |
|
|
29
|
+
| Emit runtime schema | Produce the schema imported by `createManifesto()` |
|
|
30
|
+
| Emit optional TypeScript facade | Write generated domain types for larger SDK apps |
|
|
31
|
+
| Lower runtime/context expressions | Lower `$runtime.*` and `$context.*` references for deterministic runtime evaluation |
|
|
25
32
|
|
|
26
33
|
---
|
|
27
34
|
|
|
@@ -29,15 +36,15 @@ MEL source -> Compiler -> DomainSchema -> Core
|
|
|
29
36
|
|
|
30
37
|
| NOT Responsible For | Who Is |
|
|
31
38
|
| --- | --- |
|
|
32
|
-
| Execute
|
|
33
|
-
| Apply
|
|
34
|
-
|
|
|
39
|
+
| Execute external work | Runtime effect handlers |
|
|
40
|
+
| Apply domain transitions | Manifesto runtime |
|
|
41
|
+
| Add optional approval/history protocols | `@manifesto-ai/governance` + `@manifesto-ai/lineage` |
|
|
35
42
|
| Bind UI or caller integrations | SDK / application layer |
|
|
36
43
|
|
|
37
44
|
Current MEL/compiler highlights:
|
|
38
45
|
|
|
39
46
|
- `available when` remains the coarse action gate.
|
|
40
|
-
- `dispatchable when` is the fine
|
|
47
|
+
- `dispatchable when` is the fine input-specific legality gate.
|
|
41
48
|
- Expression-level collection builtins include `filter`, `map`, `find`, `every`, and `some`.
|
|
42
49
|
- Bounded parser-free sugar includes `absDiff`, `clamp`, `idiv`, `streak`, `match`, `argmax`, and `argmin`.
|
|
43
50
|
- Current schema-position lowering supports `Record<string, T>` and `T | null`.
|
|
@@ -122,31 +129,32 @@ import { createCompilerCodegen } from "@manifesto-ai/codegen";
|
|
|
122
129
|
|
|
123
130
|
melPlugin({
|
|
124
131
|
include: /\.mel$/, // File filter (default: /\.mel$/)
|
|
125
|
-
codegen:
|
|
126
|
-
emit: createCompilerCodegen(),
|
|
127
|
-
timing: "transform", // default: run during dev/build transforms
|
|
128
|
-
},
|
|
132
|
+
codegen: createCompilerCodegen(),
|
|
129
133
|
});
|
|
130
134
|
```
|
|
131
135
|
|
|
132
|
-
`codegen` is an explicit emitter hook. `@manifesto-ai/compiler` does not import
|
|
136
|
+
`codegen` is an explicit emitter hook. `@manifesto-ai/compiler` does not import
|
|
137
|
+
`@manifesto-ai/codegen` for you; install it only if you want MEL artifacts
|
|
138
|
+
written during dev or build and inject the emitter yourself.
|
|
133
139
|
|
|
134
|
-
`createCompilerCodegen()` can be called with no options. In that default mode
|
|
140
|
+
`createCompilerCodegen()` can be called with no options. In that default mode
|
|
141
|
+
it writes `<source>.domain.ts` next to the compiled `.mel` file during
|
|
142
|
+
transform. You can still customize the generated facade:
|
|
135
143
|
|
|
136
144
|
```typescript
|
|
137
145
|
import { createCompilerCodegen, createDomainPlugin } from "@manifesto-ai/codegen";
|
|
138
146
|
|
|
139
147
|
melPlugin({
|
|
140
|
-
codegen: {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}),
|
|
145
|
-
timing: "build",
|
|
146
|
-
},
|
|
148
|
+
codegen: createCompilerCodegen({
|
|
149
|
+
outDir: "src/generated",
|
|
150
|
+
plugins: [createDomainPlugin({ interfaceName: "TodoDomain" })],
|
|
151
|
+
}),
|
|
147
152
|
});
|
|
148
153
|
```
|
|
149
154
|
|
|
155
|
+
Advanced build setups can still pass `{ emit, timing }` when they need build-end
|
|
156
|
+
or dual transform/build emission.
|
|
157
|
+
|
|
150
158
|
### Subpath Exports
|
|
151
159
|
|
|
152
160
|
| Export | Bundler |
|
|
@@ -181,12 +189,12 @@ const source = `
|
|
|
181
189
|
domain Counter {
|
|
182
190
|
state { count: number = 0 }
|
|
183
191
|
action increment() {
|
|
184
|
-
|
|
192
|
+
onceIntent { patch count = count + 1 }
|
|
185
193
|
}
|
|
186
194
|
}
|
|
187
195
|
`;
|
|
188
196
|
|
|
189
|
-
const result = compile(source
|
|
197
|
+
const result = compile(source);
|
|
190
198
|
|
|
191
199
|
if (!result.success) {
|
|
192
200
|
console.error(result.errors);
|
|
@@ -202,10 +210,13 @@ const errors = check(source);
|
|
|
202
210
|
```typescript
|
|
203
211
|
type CompileOptions = {
|
|
204
212
|
skipSemanticAnalysis?: boolean;
|
|
205
|
-
lowerSystemValues?: boolean;
|
|
206
213
|
};
|
|
207
214
|
```
|
|
208
215
|
|
|
216
|
+
Legacy compatibility options may still exist for older call sites, but they are
|
|
217
|
+
not current v5 integration seams. Runtime facts are represented through
|
|
218
|
+
`$runtime.*` and explicit Core `Context`, not compiler-lowered system values.
|
|
219
|
+
|
|
209
220
|
---
|
|
210
221
|
|
|
211
222
|
## Documentation
|