@mmapp/react-compiler 0.1.0-alpha.6 → 0.1.0-alpha.9

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.
Files changed (103) hide show
  1. package/dist/auth-3UK75242.mjs +17 -0
  2. package/dist/babel/index.d.mts +2 -2
  3. package/dist/babel/index.d.ts +2 -2
  4. package/dist/babel/index.js +5 -5
  5. package/dist/babel/index.mjs +1 -1
  6. package/dist/chunk-5FTDWKHH.mjs +244 -0
  7. package/dist/chunk-7JRAEFRB.mjs +7510 -0
  8. package/dist/chunk-7T6Q5KAA.mjs +7506 -0
  9. package/dist/chunk-ABYPKRSB.mjs +215 -0
  10. package/dist/chunk-BZEXUPDH.mjs +175 -0
  11. package/dist/chunk-HRYR54PT.mjs +175 -0
  12. package/dist/chunk-J3M4GUS7.mjs +161 -0
  13. package/dist/chunk-JRGFBWTN.mjs +2918 -0
  14. package/dist/chunk-O4AUS7EU.mjs +148 -0
  15. package/dist/chunk-R2DD5GTY.mjs +186 -0
  16. package/dist/chunk-UDDTWG5J.mjs +734 -0
  17. package/dist/chunk-VLTKQDJ3.mjs +244 -0
  18. package/dist/chunk-WVYY32LD.mjs +939 -0
  19. package/dist/chunk-XDVM4YHX.mjs +3450 -0
  20. package/dist/chunk-Z2G5RZ4H.mjs +186 -0
  21. package/dist/chunk-ZE3KCHBM.mjs +2918 -0
  22. package/dist/cli/index.js +4350 -3206
  23. package/dist/cli/index.mjs +77 -179
  24. package/dist/codemod/cli.js +1 -1
  25. package/dist/codemod/cli.mjs +1 -1
  26. package/dist/codemod/index.d.mts +3 -3
  27. package/dist/codemod/index.d.ts +3 -3
  28. package/dist/codemod/index.js +1 -1
  29. package/dist/codemod/index.mjs +1 -1
  30. package/dist/deploy-YAJGW6II.mjs +9 -0
  31. package/dist/dev-server-CrQ041KP.d.mts +79 -0
  32. package/dist/dev-server-CrQ041KP.d.ts +79 -0
  33. package/dist/dev-server.d.mts +2 -2
  34. package/dist/dev-server.d.ts +2 -2
  35. package/dist/dev-server.js +1218 -86
  36. package/dist/dev-server.mjs +4 -4
  37. package/dist/envelope-ChEkuHij.d.mts +265 -0
  38. package/dist/envelope-ChEkuHij.d.ts +265 -0
  39. package/dist/envelope.d.mts +2 -2
  40. package/dist/envelope.d.ts +2 -2
  41. package/dist/envelope.js +5 -5
  42. package/dist/envelope.mjs +2 -2
  43. package/dist/index-CEKyyazf.d.mts +104 -0
  44. package/dist/index-CEKyyazf.d.ts +104 -0
  45. package/dist/index.d.mts +8 -8
  46. package/dist/index.d.ts +8 -8
  47. package/dist/index.js +1266 -342
  48. package/dist/index.mjs +8 -8
  49. package/dist/init-7FJENUDK.mjs +407 -0
  50. package/dist/project-compiler-NNK32MPG.mjs +10 -0
  51. package/dist/project-compiler-ZB4RUYVL.mjs +10 -0
  52. package/dist/project-decompiler-U55HQUHW.mjs +7 -0
  53. package/dist/pull-KOL2QAYQ.mjs +109 -0
  54. package/dist/seed-KOGEPGOJ.mjs +154 -0
  55. package/dist/server-VW6UPCHO.mjs +277 -0
  56. package/dist/testing/index.d.mts +8 -8
  57. package/dist/testing/index.d.ts +8 -8
  58. package/dist/testing/index.js +5 -5
  59. package/dist/testing/index.mjs +1 -1
  60. package/dist/verify-BYHUKARQ.mjs +1833 -0
  61. package/dist/verify-OQDEQYMS.mjs +1833 -0
  62. package/dist/vite/index.d.mts +1 -1
  63. package/dist/vite/index.d.ts +1 -1
  64. package/dist/vite/index.js +5 -5
  65. package/dist/vite/index.mjs +2 -2
  66. package/examples/authentication/main.workflow.tsx +1 -1
  67. package/examples/authentication/mm.config.ts +1 -1
  68. package/examples/authentication/pages/LoginPage.tsx +2 -2
  69. package/examples/authentication/pages/SignupPage.tsx +2 -2
  70. package/examples/counter.workflow.tsx +1 -1
  71. package/examples/dashboard.workflow.tsx +1 -1
  72. package/examples/invoice-approval/actions/invoice.server.ts +1 -1
  73. package/examples/invoice-approval/main.workflow.tsx +1 -1
  74. package/examples/invoice-approval/mm.config.ts +1 -1
  75. package/examples/invoice-approval/pages/InvoiceDetailPage.tsx +1 -1
  76. package/examples/invoice-approval/pages/InvoiceFormPage.tsx +1 -1
  77. package/examples/invoice-approval/pages/InvoiceListPage.tsx +1 -1
  78. package/examples/todo-app.workflow.tsx +1 -1
  79. package/examples/uber-app/actions/matching.server.ts +1 -1
  80. package/examples/uber-app/actions/notifications.server.ts +1 -1
  81. package/examples/uber-app/actions/payments.server.ts +1 -1
  82. package/examples/uber-app/actions/pricing.server.ts +1 -1
  83. package/examples/uber-app/app/admin/analytics.tsx +2 -2
  84. package/examples/uber-app/app/admin/fleet.tsx +2 -2
  85. package/examples/uber-app/app/admin/surge-pricing.tsx +2 -2
  86. package/examples/uber-app/app/driver/dashboard.tsx +2 -2
  87. package/examples/uber-app/app/driver/earnings.tsx +2 -2
  88. package/examples/uber-app/app/driver/navigation.tsx +2 -2
  89. package/examples/uber-app/app/driver/ride-acceptance.tsx +2 -2
  90. package/examples/uber-app/app/rider/home.tsx +2 -2
  91. package/examples/uber-app/app/rider/payment-methods.tsx +2 -2
  92. package/examples/uber-app/app/rider/ride-history.tsx +2 -2
  93. package/examples/uber-app/app/rider/ride-tracking.tsx +2 -2
  94. package/examples/uber-app/components/DriverCard.tsx +1 -1
  95. package/examples/uber-app/components/MapView.tsx +3 -3
  96. package/examples/uber-app/components/RatingStars.tsx +2 -2
  97. package/examples/uber-app/components/RideCard.tsx +1 -1
  98. package/examples/uber-app/mm.config.ts +1 -1
  99. package/examples/uber-app/workflows/dispute-resolution.workflow.tsx +2 -2
  100. package/examples/uber-app/workflows/driver-onboarding.workflow.tsx +2 -2
  101. package/examples/uber-app/workflows/payment-processing.workflow.tsx +2 -2
  102. package/examples/uber-app/workflows/ride-request.workflow.tsx +2 -2
  103. package/package.json +9 -13
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createDevServer
3
- } from "./chunk-5GUFFFGL.mjs";
4
- import "./chunk-EO6SYNCG.mjs";
5
- import "./chunk-THFYE5ZX.mjs";
3
+ } from "./chunk-UDDTWG5J.mjs";
4
+ import "./chunk-BZEXUPDH.mjs";
5
+ import "./chunk-VLTKQDJ3.mjs";
6
6
  import "./chunk-5M7DKKBC.mjs";
7
- import "./chunk-OPJKP747.mjs";
7
+ import "./chunk-7T6Q5KAA.mjs";
8
8
  import "./chunk-CIESM3BP.mjs";
9
9
  export {
10
10
  createDevServer
@@ -0,0 +1,265 @@
1
+ import { IRWorkflowDefinition } from '@mmapp/player-core';
2
+
3
+ /**
4
+ * File System Tree — generates a manifest of project files with roles and hashes.
5
+ *
6
+ * The fs.tree is the first component of the source envelope.
7
+ * It maps every source file to its role in the workflow project.
8
+ *
9
+ * Roles:
10
+ * - view-entry: .workflow.tsx files (main workflow components)
11
+ * - model: models/*.ts files (workflow definitions)
12
+ * - server-action: *.server.ts files (backend action handlers)
13
+ * - layout: layout.tsx files (route layout boundaries)
14
+ * - page: page.tsx files (route page components)
15
+ * - config: mm.config.ts, blueprint.config.ts
16
+ * - component: regular .tsx components used by workflows
17
+ * - asset: static assets (images, styles, etc.)
18
+ * - unknown: unclassified files
19
+ */
20
+ type FileRole = 'view-entry' | 'model' | 'server-action' | 'layout' | 'page' | 'config' | 'component' | 'test' | 'asset' | 'unknown';
21
+ interface FsTreeEntry {
22
+ /** Relative path from project root. */
23
+ path: string;
24
+ /** File role in the workflow project. */
25
+ role: FileRole;
26
+ /** SHA-256 content hash. */
27
+ hash: string;
28
+ /** File size in bytes. */
29
+ size: number;
30
+ /** Last modified timestamp. */
31
+ mtime: string;
32
+ /** Workflow slug (for view-entry and model files). */
33
+ slug?: string;
34
+ }
35
+ interface FsTree {
36
+ /** fs.tree format version. */
37
+ version: 1;
38
+ /** Project root directory (absolute). */
39
+ root: string;
40
+ /** Timestamp when the tree was generated. */
41
+ generatedAt: string;
42
+ /** File entries. */
43
+ entries: FsTreeEntry[];
44
+ /** Summary statistics. */
45
+ summary: {
46
+ totalFiles: number;
47
+ byRole: Record<FileRole, number>;
48
+ totalSize: number;
49
+ };
50
+ }
51
+ /**
52
+ * Determines the role of a file based on its path and naming convention.
53
+ */
54
+ declare function detectFileRole(relativePath: string): FileRole;
55
+ /**
56
+ * Generates an FsTree from a list of file paths.
57
+ */
58
+ declare function generateFsTree(files: string[], rootDir: string): FsTree;
59
+ /**
60
+ * Filters an FsTree to only include specific roles.
61
+ */
62
+ declare function filterByRole(tree: FsTree, roles: FileRole[]): FsTreeEntry[];
63
+ /**
64
+ * Finds changed files between two FsTree snapshots.
65
+ */
66
+ declare function diffFsTrees(before: FsTree, after: FsTree): {
67
+ added: FsTreeEntry[];
68
+ removed: FsTreeEntry[];
69
+ modified: FsTreeEntry[];
70
+ };
71
+
72
+ /**
73
+ * Source Envelope — bundles compiled workflows with source metadata.
74
+ *
75
+ * A source envelope is the unit of deployment. It contains:
76
+ * 1. All compiled workflow definitions (IR)
77
+ * 2. File manifest (fs.tree) with content hashes
78
+ * 3. Source bindings (semantic refs ↔ file spans)
79
+ * 4. Deployment metadata (version, timestamp, environment)
80
+ *
81
+ * The envelope enables:
82
+ * - Immutable versioning (content-addressed)
83
+ * - Source-level debugging (map IR back to .tsx source)
84
+ * - Differential deployment (only deploy changed workflows)
85
+ * - P2P sync (envelope is the unit of transfer)
86
+ */
87
+
88
+ interface SourceEnvelope {
89
+ /** Envelope format version. */
90
+ version: 1;
91
+ /** Content-addressed envelope ID (SHA-256 of canonical content). */
92
+ envelopeId: string;
93
+ /** Blueprint slug this envelope belongs to. */
94
+ blueprintSlug: string;
95
+ /** Blueprint version. */
96
+ blueprintVersion: string;
97
+ /** When the envelope was created. */
98
+ createdAt: string;
99
+ /** Deployment target environment. */
100
+ environment?: string;
101
+ /** Compiled workflow definitions. */
102
+ definitions: IRWorkflowDefinition[];
103
+ /** File manifest. */
104
+ fsTree: FsTree;
105
+ /** Source bindings (IR element → source location). */
106
+ sourceBindings: SourceBinding[];
107
+ /** Deployment metadata. */
108
+ metadata: EnvelopeMetadata;
109
+ }
110
+ /**
111
+ * Maps an IR element to its source location.
112
+ */
113
+ interface SourceBinding {
114
+ /** Type of IR element. */
115
+ kind: 'field' | 'state' | 'transition' | 'action' | 'component' | 'grammar-island';
116
+ /** Name/ID of the element. */
117
+ name: string;
118
+ /** Workflow slug this binding belongs to. */
119
+ workflowSlug: string;
120
+ /** Source file path (relative). */
121
+ file: string;
122
+ /** Start line (1-based). */
123
+ startLine: number;
124
+ /** Start column (0-based). */
125
+ startColumn: number;
126
+ /** End line (1-based). */
127
+ endLine?: number;
128
+ /** End column (0-based). */
129
+ endColumn?: number;
130
+ }
131
+ /**
132
+ * Deployment metadata.
133
+ */
134
+ interface EnvelopeMetadata {
135
+ /** Total number of workflow definitions. */
136
+ definitionCount: number;
137
+ /** Total number of fields across all definitions. */
138
+ totalFields: number;
139
+ /** Total number of states across all definitions. */
140
+ totalStates: number;
141
+ /** Total number of transitions across all definitions. */
142
+ totalTransitions: number;
143
+ /** Compiler version. */
144
+ compilerVersion: string;
145
+ /** Build mode. */
146
+ mode: 'strict' | 'infer';
147
+ /** Whether any errors were detected. */
148
+ hasErrors: boolean;
149
+ /** Error/warning summary. */
150
+ diagnostics: DiagnosticSummary;
151
+ }
152
+ interface DiagnosticSummary {
153
+ errors: number;
154
+ warnings: number;
155
+ errorCodes: string[];
156
+ }
157
+ /**
158
+ * Creates a source envelope from compiled definitions.
159
+ */
160
+ declare function createSourceEnvelope(params: {
161
+ blueprintSlug: string;
162
+ blueprintVersion: string;
163
+ definitions: IRWorkflowDefinition[];
164
+ fsTree: FsTree;
165
+ sourceBindings?: SourceBinding[];
166
+ environment?: string;
167
+ mode?: 'strict' | 'infer';
168
+ compilerVersion?: string;
169
+ }): SourceEnvelope;
170
+ /**
171
+ * Computes a content-addressed ID for an envelope.
172
+ * Uses SHA-256 of the canonical JSON (sorted keys, no whitespace).
173
+ */
174
+ declare function computeEnvelopeId(envelope: SourceEnvelope): string;
175
+ /**
176
+ * Checks if two envelopes have the same content (ignoring timestamps).
177
+ */
178
+ declare function envelopesEqual(a: SourceEnvelope, b: SourceEnvelope): boolean;
179
+ /**
180
+ * Finds definitions that changed between two envelopes.
181
+ */
182
+ declare function diffEnvelopes(before: SourceEnvelope, after: SourceEnvelope): {
183
+ added: string[];
184
+ removed: string[];
185
+ modified: string[];
186
+ unchanged: string[];
187
+ };
188
+
189
+ /**
190
+ * Envelope Builder — walks a project directory, compiles all .workflow.tsx files,
191
+ * and produces a content-addressed SHA-256 deployment bundle.
192
+ *
193
+ * This is the high-level API that combines:
194
+ * - File discovery (fs-tree)
195
+ * - Compilation (babel plugin)
196
+ * - Source binding extraction
197
+ * - Content-addressed envelope creation
198
+ *
199
+ * Usage:
200
+ * import { buildEnvelope } from '@mmapp/react-compiler';
201
+ * const envelope = await buildEnvelope('./src/workflows', { slug: 'my-app' });
202
+ * // envelope.manifest.hash === 'a1b2c3...' (SHA-256)
203
+ */
204
+
205
+ interface EnvelopeManifest {
206
+ /** Content-addressed SHA-256 hash of the entire envelope. */
207
+ hash: string;
208
+ /** Files included in the envelope (relative paths). */
209
+ files: EnvelopeFile[];
210
+ /** Blueprint version string. */
211
+ version: string;
212
+ /** ISO 8601 timestamp. */
213
+ timestamp: string;
214
+ /** Total compiled definitions. */
215
+ definitionCount: number;
216
+ /** Total compilation errors. */
217
+ errorCount: number;
218
+ }
219
+ interface EnvelopeFile {
220
+ /** Relative path from project root. */
221
+ path: string;
222
+ /** SHA-256 hash of file content. */
223
+ hash: string;
224
+ /** File size in bytes. */
225
+ size: number;
226
+ /** Workflow slug (if this file produced a definition). */
227
+ slug?: string;
228
+ /** Whether compilation succeeded for this file. */
229
+ compiled: boolean;
230
+ }
231
+ interface BuildEnvelopeOptions {
232
+ /** Blueprint slug. Default: basename of projectDir */
233
+ slug?: string;
234
+ /** Blueprint version. Default: '0.1.0' */
235
+ version?: string;
236
+ /** Compilation mode. Default: 'infer' */
237
+ mode?: 'strict' | 'infer';
238
+ /** Glob patterns for files to include. Default: discovers all workflow-related files */
239
+ include?: string[];
240
+ /** Environment tag. Default: undefined */
241
+ environment?: string;
242
+ }
243
+ interface BuildEnvelopeResult {
244
+ /** The complete source envelope. */
245
+ envelope: SourceEnvelope;
246
+ /** Content-addressed manifest for the bundle. */
247
+ manifest: EnvelopeManifest;
248
+ /** Individual file compilation results. */
249
+ files: EnvelopeFile[];
250
+ /** Definitions that compiled successfully. */
251
+ definitions: IRWorkflowDefinition[];
252
+ /** Compilation errors. */
253
+ errors: Array<{
254
+ file: string;
255
+ message: string;
256
+ line?: number;
257
+ }>;
258
+ }
259
+ /**
260
+ * Walk a project directory, compile all workflow files, and produce a
261
+ * content-addressed deployment bundle.
262
+ */
263
+ declare function buildEnvelope(projectDir: string, options?: BuildEnvelopeOptions): Promise<BuildEnvelopeResult>;
264
+
265
+ export { type BuildEnvelopeOptions as B, type EnvelopeManifest as E, type FileRole as F, type SourceEnvelope as S, type EnvelopeFile as a, buildEnvelope as b, type BuildEnvelopeResult as c, createSourceEnvelope as d, computeEnvelopeId as e, envelopesEqual as f, diffEnvelopes as g, type SourceBinding as h, type EnvelopeMetadata as i, generateFsTree as j, detectFileRole as k, filterByRole as l, diffFsTrees as m, type FsTree as n, type FsTreeEntry as o };
@@ -0,0 +1,265 @@
1
+ import { IRWorkflowDefinition } from '@mmapp/player-core';
2
+
3
+ /**
4
+ * File System Tree — generates a manifest of project files with roles and hashes.
5
+ *
6
+ * The fs.tree is the first component of the source envelope.
7
+ * It maps every source file to its role in the workflow project.
8
+ *
9
+ * Roles:
10
+ * - view-entry: .workflow.tsx files (main workflow components)
11
+ * - model: models/*.ts files (workflow definitions)
12
+ * - server-action: *.server.ts files (backend action handlers)
13
+ * - layout: layout.tsx files (route layout boundaries)
14
+ * - page: page.tsx files (route page components)
15
+ * - config: mm.config.ts, blueprint.config.ts
16
+ * - component: regular .tsx components used by workflows
17
+ * - asset: static assets (images, styles, etc.)
18
+ * - unknown: unclassified files
19
+ */
20
+ type FileRole = 'view-entry' | 'model' | 'server-action' | 'layout' | 'page' | 'config' | 'component' | 'test' | 'asset' | 'unknown';
21
+ interface FsTreeEntry {
22
+ /** Relative path from project root. */
23
+ path: string;
24
+ /** File role in the workflow project. */
25
+ role: FileRole;
26
+ /** SHA-256 content hash. */
27
+ hash: string;
28
+ /** File size in bytes. */
29
+ size: number;
30
+ /** Last modified timestamp. */
31
+ mtime: string;
32
+ /** Workflow slug (for view-entry and model files). */
33
+ slug?: string;
34
+ }
35
+ interface FsTree {
36
+ /** fs.tree format version. */
37
+ version: 1;
38
+ /** Project root directory (absolute). */
39
+ root: string;
40
+ /** Timestamp when the tree was generated. */
41
+ generatedAt: string;
42
+ /** File entries. */
43
+ entries: FsTreeEntry[];
44
+ /** Summary statistics. */
45
+ summary: {
46
+ totalFiles: number;
47
+ byRole: Record<FileRole, number>;
48
+ totalSize: number;
49
+ };
50
+ }
51
+ /**
52
+ * Determines the role of a file based on its path and naming convention.
53
+ */
54
+ declare function detectFileRole(relativePath: string): FileRole;
55
+ /**
56
+ * Generates an FsTree from a list of file paths.
57
+ */
58
+ declare function generateFsTree(files: string[], rootDir: string): FsTree;
59
+ /**
60
+ * Filters an FsTree to only include specific roles.
61
+ */
62
+ declare function filterByRole(tree: FsTree, roles: FileRole[]): FsTreeEntry[];
63
+ /**
64
+ * Finds changed files between two FsTree snapshots.
65
+ */
66
+ declare function diffFsTrees(before: FsTree, after: FsTree): {
67
+ added: FsTreeEntry[];
68
+ removed: FsTreeEntry[];
69
+ modified: FsTreeEntry[];
70
+ };
71
+
72
+ /**
73
+ * Source Envelope — bundles compiled workflows with source metadata.
74
+ *
75
+ * A source envelope is the unit of deployment. It contains:
76
+ * 1. All compiled workflow definitions (IR)
77
+ * 2. File manifest (fs.tree) with content hashes
78
+ * 3. Source bindings (semantic refs ↔ file spans)
79
+ * 4. Deployment metadata (version, timestamp, environment)
80
+ *
81
+ * The envelope enables:
82
+ * - Immutable versioning (content-addressed)
83
+ * - Source-level debugging (map IR back to .tsx source)
84
+ * - Differential deployment (only deploy changed workflows)
85
+ * - P2P sync (envelope is the unit of transfer)
86
+ */
87
+
88
+ interface SourceEnvelope {
89
+ /** Envelope format version. */
90
+ version: 1;
91
+ /** Content-addressed envelope ID (SHA-256 of canonical content). */
92
+ envelopeId: string;
93
+ /** Blueprint slug this envelope belongs to. */
94
+ blueprintSlug: string;
95
+ /** Blueprint version. */
96
+ blueprintVersion: string;
97
+ /** When the envelope was created. */
98
+ createdAt: string;
99
+ /** Deployment target environment. */
100
+ environment?: string;
101
+ /** Compiled workflow definitions. */
102
+ definitions: IRWorkflowDefinition[];
103
+ /** File manifest. */
104
+ fsTree: FsTree;
105
+ /** Source bindings (IR element → source location). */
106
+ sourceBindings: SourceBinding[];
107
+ /** Deployment metadata. */
108
+ metadata: EnvelopeMetadata;
109
+ }
110
+ /**
111
+ * Maps an IR element to its source location.
112
+ */
113
+ interface SourceBinding {
114
+ /** Type of IR element. */
115
+ kind: 'field' | 'state' | 'transition' | 'action' | 'component' | 'grammar-island';
116
+ /** Name/ID of the element. */
117
+ name: string;
118
+ /** Workflow slug this binding belongs to. */
119
+ workflowSlug: string;
120
+ /** Source file path (relative). */
121
+ file: string;
122
+ /** Start line (1-based). */
123
+ startLine: number;
124
+ /** Start column (0-based). */
125
+ startColumn: number;
126
+ /** End line (1-based). */
127
+ endLine?: number;
128
+ /** End column (0-based). */
129
+ endColumn?: number;
130
+ }
131
+ /**
132
+ * Deployment metadata.
133
+ */
134
+ interface EnvelopeMetadata {
135
+ /** Total number of workflow definitions. */
136
+ definitionCount: number;
137
+ /** Total number of fields across all definitions. */
138
+ totalFields: number;
139
+ /** Total number of states across all definitions. */
140
+ totalStates: number;
141
+ /** Total number of transitions across all definitions. */
142
+ totalTransitions: number;
143
+ /** Compiler version. */
144
+ compilerVersion: string;
145
+ /** Build mode. */
146
+ mode: 'strict' | 'infer';
147
+ /** Whether any errors were detected. */
148
+ hasErrors: boolean;
149
+ /** Error/warning summary. */
150
+ diagnostics: DiagnosticSummary;
151
+ }
152
+ interface DiagnosticSummary {
153
+ errors: number;
154
+ warnings: number;
155
+ errorCodes: string[];
156
+ }
157
+ /**
158
+ * Creates a source envelope from compiled definitions.
159
+ */
160
+ declare function createSourceEnvelope(params: {
161
+ blueprintSlug: string;
162
+ blueprintVersion: string;
163
+ definitions: IRWorkflowDefinition[];
164
+ fsTree: FsTree;
165
+ sourceBindings?: SourceBinding[];
166
+ environment?: string;
167
+ mode?: 'strict' | 'infer';
168
+ compilerVersion?: string;
169
+ }): SourceEnvelope;
170
+ /**
171
+ * Computes a content-addressed ID for an envelope.
172
+ * Uses SHA-256 of the canonical JSON (sorted keys, no whitespace).
173
+ */
174
+ declare function computeEnvelopeId(envelope: SourceEnvelope): string;
175
+ /**
176
+ * Checks if two envelopes have the same content (ignoring timestamps).
177
+ */
178
+ declare function envelopesEqual(a: SourceEnvelope, b: SourceEnvelope): boolean;
179
+ /**
180
+ * Finds definitions that changed between two envelopes.
181
+ */
182
+ declare function diffEnvelopes(before: SourceEnvelope, after: SourceEnvelope): {
183
+ added: string[];
184
+ removed: string[];
185
+ modified: string[];
186
+ unchanged: string[];
187
+ };
188
+
189
+ /**
190
+ * Envelope Builder — walks a project directory, compiles all .workflow.tsx files,
191
+ * and produces a content-addressed SHA-256 deployment bundle.
192
+ *
193
+ * This is the high-level API that combines:
194
+ * - File discovery (fs-tree)
195
+ * - Compilation (babel plugin)
196
+ * - Source binding extraction
197
+ * - Content-addressed envelope creation
198
+ *
199
+ * Usage:
200
+ * import { buildEnvelope } from '@mmapp/react-compiler';
201
+ * const envelope = await buildEnvelope('./src/workflows', { slug: 'my-app' });
202
+ * // envelope.manifest.hash === 'a1b2c3...' (SHA-256)
203
+ */
204
+
205
+ interface EnvelopeManifest {
206
+ /** Content-addressed SHA-256 hash of the entire envelope. */
207
+ hash: string;
208
+ /** Files included in the envelope (relative paths). */
209
+ files: EnvelopeFile[];
210
+ /** Blueprint version string. */
211
+ version: string;
212
+ /** ISO 8601 timestamp. */
213
+ timestamp: string;
214
+ /** Total compiled definitions. */
215
+ definitionCount: number;
216
+ /** Total compilation errors. */
217
+ errorCount: number;
218
+ }
219
+ interface EnvelopeFile {
220
+ /** Relative path from project root. */
221
+ path: string;
222
+ /** SHA-256 hash of file content. */
223
+ hash: string;
224
+ /** File size in bytes. */
225
+ size: number;
226
+ /** Workflow slug (if this file produced a definition). */
227
+ slug?: string;
228
+ /** Whether compilation succeeded for this file. */
229
+ compiled: boolean;
230
+ }
231
+ interface BuildEnvelopeOptions {
232
+ /** Blueprint slug. Default: basename of projectDir */
233
+ slug?: string;
234
+ /** Blueprint version. Default: '0.1.0' */
235
+ version?: string;
236
+ /** Compilation mode. Default: 'infer' */
237
+ mode?: 'strict' | 'infer';
238
+ /** Glob patterns for files to include. Default: discovers all workflow-related files */
239
+ include?: string[];
240
+ /** Environment tag. Default: undefined */
241
+ environment?: string;
242
+ }
243
+ interface BuildEnvelopeResult {
244
+ /** The complete source envelope. */
245
+ envelope: SourceEnvelope;
246
+ /** Content-addressed manifest for the bundle. */
247
+ manifest: EnvelopeManifest;
248
+ /** Individual file compilation results. */
249
+ files: EnvelopeFile[];
250
+ /** Definitions that compiled successfully. */
251
+ definitions: IRWorkflowDefinition[];
252
+ /** Compilation errors. */
253
+ errors: Array<{
254
+ file: string;
255
+ message: string;
256
+ line?: number;
257
+ }>;
258
+ }
259
+ /**
260
+ * Walk a project directory, compile all workflow files, and produce a
261
+ * content-addressed deployment bundle.
262
+ */
263
+ declare function buildEnvelope(projectDir: string, options?: BuildEnvelopeOptions): Promise<BuildEnvelopeResult>;
264
+
265
+ export { type BuildEnvelopeOptions as B, type EnvelopeManifest as E, type FileRole as F, type SourceEnvelope as S, type EnvelopeFile as a, buildEnvelope as b, type BuildEnvelopeResult as c, createSourceEnvelope as d, computeEnvelopeId as e, envelopesEqual as f, diffEnvelopes as g, type SourceBinding as h, type EnvelopeMetadata as i, generateFsTree as j, detectFileRole as k, filterByRole as l, diffFsTrees as m, type FsTree as n, type FsTreeEntry as o };
@@ -1,2 +1,2 @@
1
- export { B as BuildEnvelopeOptions, c as BuildEnvelopeResult, a as EnvelopeFile, E as EnvelopeManifest, b as buildEnvelope } from './envelope-DD7v0v6E.mjs';
2
- import '@mindmatrix/player-core';
1
+ export { B as BuildEnvelopeOptions, c as BuildEnvelopeResult, a as EnvelopeFile, E as EnvelopeManifest, b as buildEnvelope } from './envelope-ChEkuHij.mjs';
2
+ import '@mmapp/player-core';
@@ -1,2 +1,2 @@
1
- export { B as BuildEnvelopeOptions, c as BuildEnvelopeResult, a as EnvelopeFile, E as EnvelopeManifest, b as buildEnvelope } from './envelope-DD7v0v6E.js';
2
- import '@mindmatrix/player-core';
1
+ export { B as BuildEnvelopeOptions, c as BuildEnvelopeResult, a as EnvelopeFile, E as EnvelopeManifest, b as buildEnvelope } from './envelope-ChEkuHij.js';
2
+ import '@mmapp/player-core';
package/dist/envelope.js CHANGED
@@ -4228,7 +4228,7 @@ function extractImperativeWorkflow(path, state) {
4228
4228
  const source = node.source.value;
4229
4229
  for (const spec of node.specifiers) {
4230
4230
  const localName = spec.local.name;
4231
- if (source.includes("@mmapp/react") || source.includes("@mindmatrix/react")) {
4231
+ if (source.includes("@mmapp/react") || source.includes("@mmapp/react")) {
4232
4232
  stdLibImports.add(localName);
4233
4233
  } else {
4234
4234
  importedFns.set(localName, source);
@@ -5999,7 +5999,7 @@ function extractStaticObj(obj) {
5999
5999
  }
6000
6000
 
6001
6001
  // src/babel/emitters/pure-form-emitter.ts
6002
- var import_player_core = require("@mindmatrix/player-core");
6002
+ var import_player_core = require("@mmapp/player-core");
6003
6003
 
6004
6004
  // src/babel/emitters/experience-transform.ts
6005
6005
  function transformToFrontend(node) {
@@ -7173,7 +7173,7 @@ function createVisitor(options = {}) {
7173
7173
  if (mode === "strict" && STRICT_BANNED_HOOKS[hookName]) {
7174
7174
  const error = {
7175
7175
  code: STRICT_BANNED_HOOKS[hookName],
7176
- message: `${hookName}() is not allowed in strict mode. Use @mindmatrix/react effect hooks instead.`,
7176
+ message: `${hookName}() is not allowed in strict mode. Use @mmapp/react effect hooks instead.`,
7177
7177
  line: path.node.loc?.start.line,
7178
7178
  column: path.node.loc?.start.column,
7179
7179
  severity: "error"
@@ -7265,12 +7265,12 @@ function createVisitor(options = {}) {
7265
7265
  }
7266
7266
  }
7267
7267
  if (mode !== "strict") return;
7268
- if (source.startsWith("@mindmatrix/") || source.startsWith("@mmapp/") || source === "react" || source.startsWith("react/") || source.startsWith(".") || source.startsWith("/")) {
7268
+ if (source.startsWith("@mmapp/") || source.startsWith("@mmapp/") || source === "react" || source.startsWith("react/") || source.startsWith(".") || source.startsWith("/")) {
7269
7269
  return;
7270
7270
  }
7271
7271
  const error = {
7272
7272
  code: "STRICT_FORBIDDEN_IMPORT",
7273
- message: `Import from '${source}' is not allowed in strict mode. Only @mindmatrix/* and relative imports are permitted.`,
7273
+ message: `Import from '${source}' is not allowed in strict mode. Only @mmapp/* and relative imports are permitted.`,
7274
7274
  line: path.node.loc?.start.line,
7275
7275
  column: path.node.loc?.start.column,
7276
7276
  severity: "error"
package/dist/envelope.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  buildEnvelope
3
- } from "./chunk-J7JUAHS4.mjs";
3
+ } from "./chunk-R2DD5GTY.mjs";
4
4
  import "./chunk-5M7DKKBC.mjs";
5
- import "./chunk-OPJKP747.mjs";
5
+ import "./chunk-7T6Q5KAA.mjs";
6
6
  import "./chunk-CIESM3BP.mjs";
7
7
  export {
8
8
  buildEnvelope