@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
@@ -0,0 +1,104 @@
1
+ import * as _babel_traverse from '@babel/traverse';
2
+ import { IRActionDefinition, IRFieldDefinition, IRStateDefinition, IRTransitionDefinition, IROnEventSubscription, IRExperienceNode, IRGrammarIsland, CompilerErrorCode } from '@mmapp/player-core';
3
+
4
+ /**
5
+ * Change Extractor — extracts useOnChange calls and converts them to field watcher metadata.
6
+ *
7
+ * INPUT:
8
+ * useOnChange('status', (newVal, oldVal) => {
9
+ * console.log(`Status changed from ${oldVal} to ${newVal}`);
10
+ * });
11
+ *
12
+ * OUTPUT (stored in compilerState metadata.fieldWatchers[]):
13
+ * {
14
+ * id: "watcher_1",
15
+ * field: "status",
16
+ * actions: [{ id: "auto_N", type: "log_event", mode: "auto", config: { message: "..." } }]
17
+ * }
18
+ */
19
+
20
+ interface FieldWatcher {
21
+ id: string;
22
+ field: string;
23
+ actions: IRActionDefinition[];
24
+ }
25
+
26
+ /**
27
+ * Transition Effect Extractor — extracts useOnTransition calls.
28
+ *
29
+ * INPUT:
30
+ * useOnTransition(({ from, to }) => {
31
+ * console.log(`Transitioned from ${from} to ${to}`);
32
+ * });
33
+ *
34
+ * OUTPUT (stored in compilerState metadata.transitionEffects[]):
35
+ * {
36
+ * id: "transition_effect_1",
37
+ * actions: [{ id: "auto_N", type: "log_event", mode: "auto", config: { message: "..." } }]
38
+ * }
39
+ */
40
+
41
+ interface TransitionEffect {
42
+ id: string;
43
+ actions: IRActionDefinition[];
44
+ }
45
+
46
+ /**
47
+ * Internal types for the compiler state and extracted data.
48
+ */
49
+
50
+ interface ExtractedWorkflow {
51
+ slug: string;
52
+ name: string;
53
+ version: string;
54
+ description?: string;
55
+ category: string;
56
+ fields: IRFieldDefinition[];
57
+ states: Map<string, IRStateDefinition>;
58
+ transitions: IRTransitionDefinition[];
59
+ events: IROnEventSubscription[];
60
+ experience?: IRExperienceNode;
61
+ fieldWatchers?: FieldWatcher[];
62
+ transitionEffects?: TransitionEffect[];
63
+ grammarIslands?: IRGrammarIsland[];
64
+ errors?: ReactCompilerError[];
65
+ warnings?: ReactCompilerError[];
66
+ /** Extra metadata from model files (runtime, fieldOptions, etc.) */
67
+ extraMetadata?: Record<string, unknown>;
68
+ }
69
+ interface CompilerState {
70
+ fields: IRFieldDefinition[];
71
+ states: Map<string, IRStateDefinition>;
72
+ transitions: IRTransitionDefinition[];
73
+ events: IROnEventSubscription[];
74
+ experience?: IRExperienceNode;
75
+ actionCounter: number;
76
+ metadata: {
77
+ slug?: string;
78
+ name?: string;
79
+ version?: string;
80
+ description?: string;
81
+ category?: string;
82
+ [key: string]: unknown;
83
+ };
84
+ errors?: ReactCompilerError[];
85
+ warnings?: ReactCompilerError[];
86
+ }
87
+ interface CompilerOptions {
88
+ mode?: 'strict' | 'infer';
89
+ filename?: string;
90
+ }
91
+ interface ReactCompilerError {
92
+ code: CompilerErrorCode;
93
+ message: string;
94
+ line?: number;
95
+ column?: number;
96
+ severity: 'error' | 'warning';
97
+ }
98
+
99
+ declare function babelPlugin(api: any, options?: CompilerOptions): {
100
+ name: string;
101
+ visitor: _babel_traverse.Visitor;
102
+ };
103
+
104
+ export { type CompilerState as C, type ExtractedWorkflow as E, type ReactCompilerError as R, type CompilerOptions as a, babelPlugin as b };
@@ -0,0 +1,104 @@
1
+ import * as _babel_traverse from '@babel/traverse';
2
+ import { IRActionDefinition, IRFieldDefinition, IRStateDefinition, IRTransitionDefinition, IROnEventSubscription, IRExperienceNode, IRGrammarIsland, CompilerErrorCode } from '@mmapp/player-core';
3
+
4
+ /**
5
+ * Change Extractor — extracts useOnChange calls and converts them to field watcher metadata.
6
+ *
7
+ * INPUT:
8
+ * useOnChange('status', (newVal, oldVal) => {
9
+ * console.log(`Status changed from ${oldVal} to ${newVal}`);
10
+ * });
11
+ *
12
+ * OUTPUT (stored in compilerState metadata.fieldWatchers[]):
13
+ * {
14
+ * id: "watcher_1",
15
+ * field: "status",
16
+ * actions: [{ id: "auto_N", type: "log_event", mode: "auto", config: { message: "..." } }]
17
+ * }
18
+ */
19
+
20
+ interface FieldWatcher {
21
+ id: string;
22
+ field: string;
23
+ actions: IRActionDefinition[];
24
+ }
25
+
26
+ /**
27
+ * Transition Effect Extractor — extracts useOnTransition calls.
28
+ *
29
+ * INPUT:
30
+ * useOnTransition(({ from, to }) => {
31
+ * console.log(`Transitioned from ${from} to ${to}`);
32
+ * });
33
+ *
34
+ * OUTPUT (stored in compilerState metadata.transitionEffects[]):
35
+ * {
36
+ * id: "transition_effect_1",
37
+ * actions: [{ id: "auto_N", type: "log_event", mode: "auto", config: { message: "..." } }]
38
+ * }
39
+ */
40
+
41
+ interface TransitionEffect {
42
+ id: string;
43
+ actions: IRActionDefinition[];
44
+ }
45
+
46
+ /**
47
+ * Internal types for the compiler state and extracted data.
48
+ */
49
+
50
+ interface ExtractedWorkflow {
51
+ slug: string;
52
+ name: string;
53
+ version: string;
54
+ description?: string;
55
+ category: string;
56
+ fields: IRFieldDefinition[];
57
+ states: Map<string, IRStateDefinition>;
58
+ transitions: IRTransitionDefinition[];
59
+ events: IROnEventSubscription[];
60
+ experience?: IRExperienceNode;
61
+ fieldWatchers?: FieldWatcher[];
62
+ transitionEffects?: TransitionEffect[];
63
+ grammarIslands?: IRGrammarIsland[];
64
+ errors?: ReactCompilerError[];
65
+ warnings?: ReactCompilerError[];
66
+ /** Extra metadata from model files (runtime, fieldOptions, etc.) */
67
+ extraMetadata?: Record<string, unknown>;
68
+ }
69
+ interface CompilerState {
70
+ fields: IRFieldDefinition[];
71
+ states: Map<string, IRStateDefinition>;
72
+ transitions: IRTransitionDefinition[];
73
+ events: IROnEventSubscription[];
74
+ experience?: IRExperienceNode;
75
+ actionCounter: number;
76
+ metadata: {
77
+ slug?: string;
78
+ name?: string;
79
+ version?: string;
80
+ description?: string;
81
+ category?: string;
82
+ [key: string]: unknown;
83
+ };
84
+ errors?: ReactCompilerError[];
85
+ warnings?: ReactCompilerError[];
86
+ }
87
+ interface CompilerOptions {
88
+ mode?: 'strict' | 'infer';
89
+ filename?: string;
90
+ }
91
+ interface ReactCompilerError {
92
+ code: CompilerErrorCode;
93
+ message: string;
94
+ line?: number;
95
+ column?: number;
96
+ severity: 'error' | 'warning';
97
+ }
98
+
99
+ declare function babelPlugin(api: any, options?: CompilerOptions): {
100
+ name: string;
101
+ visitor: _babel_traverse.Visitor;
102
+ };
103
+
104
+ export { type CompilerState as C, type ExtractedWorkflow as E, type ReactCompilerError as R, type CompilerOptions as a, babelPlugin as b };
package/dist/index.d.mts CHANGED
@@ -1,11 +1,11 @@
1
- import { E as ExtractedWorkflow, C as CompilerState, a as CompilerOptions } from './index-revho_gS.mjs';
2
- export { R as ReactCompilerError, b as babelPlugin } from './index-revho_gS.mjs';
1
+ import { E as ExtractedWorkflow, C as CompilerState, a as CompilerOptions } from './index-CEKyyazf.mjs';
2
+ export { R as ReactCompilerError, b as babelPlugin } from './index-CEKyyazf.mjs';
3
3
  import { NodePath, Visitor } from '@babel/traverse';
4
4
  import * as t from '@babel/types';
5
- import { IRWorkflowDefinition, PureFormWorkflow, IRDataSource, IRExperienceNode as IRExperienceNode$1 } from '@mindmatrix/player-core';
6
- export { B as BuildOptions, d as BuildResult, a as DevServerInstance, D as DevServerOptions, b as build, c as createDevServer } from './dev-server-RmGHIntF.mjs';
7
- import { F as FileRole } from './envelope-DD7v0v6E.mjs';
8
- export { B as BuildEnvelopeOptions, c as BuildEnvelopeResult, a as EnvelopeFile, E as EnvelopeManifest, i as EnvelopeMetadata, n as FsTree, o as FsTreeEntry, h as SourceBinding, S as SourceEnvelope, b as buildEnvelope, e as computeEnvelopeId, d as createSourceEnvelope, k as detectFileRole, g as diffEnvelopes, m as diffFsTrees, f as envelopesEqual, l as filterByRole, j as generateFsTree } from './envelope-DD7v0v6E.mjs';
5
+ import { IRWorkflowDefinition, PureFormWorkflow, IRDataSource, IRExperienceNode as IRExperienceNode$1 } from '@mmapp/player-core';
6
+ export { B as BuildOptions, d as BuildResult, a as DevServerInstance, D as DevServerOptions, b as build, c as createDevServer } from './dev-server-CrQ041KP.mjs';
7
+ import { F as FileRole } from './envelope-ChEkuHij.mjs';
8
+ export { B as BuildEnvelopeOptions, c as BuildEnvelopeResult, a as EnvelopeFile, E as EnvelopeManifest, i as EnvelopeMetadata, n as FsTree, o as FsTreeEntry, h as SourceBinding, S as SourceEnvelope, b as buildEnvelope, e as computeEnvelopeId, d as createSourceEnvelope, k as detectFileRole, g as diffEnvelopes, m as diffFsTrees, f as envelopesEqual, l as filterByRole, j as generateFsTree } from './envelope-ChEkuHij.mjs';
9
9
  import 'vite';
10
10
 
11
11
  /**
@@ -425,7 +425,7 @@ declare function decompile(definition: DecompilerInput, options?: DecompileOptio
425
425
  * - useQuery/useMutation data sources
426
426
  * - JSX return tree from experience nodes
427
427
  * - @workflow JSDoc header
428
- * - Proper imports from @mindmatrix/react
428
+ * - Proper imports from @mmapp/react
429
429
  *
430
430
  * @param definition - The IR workflow definition (with optional experience tree).
431
431
  * @param options - Decompile options (componentName, includeAnnotation, etc.).
@@ -499,7 +499,7 @@ declare function extractComputed(path: NodePath<t.CallExpression>, state: any):
499
499
  /**
500
500
  * Babel Visitor — main AST traversal logic for extracting workflow definitions.
501
501
  *
502
- * Handles all @mindmatrix/react hooks:
502
+ * Handles all @mmapp/react hooks:
503
503
  * - useState → fields
504
504
  * - useOnEnter / useOnExit → state enter/exit actions
505
505
  * - useTransition → transitions
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { E as ExtractedWorkflow, C as CompilerState, a as CompilerOptions } from './index-revho_gS.js';
2
- export { R as ReactCompilerError, b as babelPlugin } from './index-revho_gS.js';
1
+ import { E as ExtractedWorkflow, C as CompilerState, a as CompilerOptions } from './index-CEKyyazf.js';
2
+ export { R as ReactCompilerError, b as babelPlugin } from './index-CEKyyazf.js';
3
3
  import { NodePath, Visitor } from '@babel/traverse';
4
4
  import * as t from '@babel/types';
5
- import { IRWorkflowDefinition, PureFormWorkflow, IRDataSource, IRExperienceNode as IRExperienceNode$1 } from '@mindmatrix/player-core';
6
- export { B as BuildOptions, d as BuildResult, a as DevServerInstance, D as DevServerOptions, b as build, c as createDevServer } from './dev-server-RmGHIntF.js';
7
- import { F as FileRole } from './envelope-DD7v0v6E.js';
8
- export { B as BuildEnvelopeOptions, c as BuildEnvelopeResult, a as EnvelopeFile, E as EnvelopeManifest, i as EnvelopeMetadata, n as FsTree, o as FsTreeEntry, h as SourceBinding, S as SourceEnvelope, b as buildEnvelope, e as computeEnvelopeId, d as createSourceEnvelope, k as detectFileRole, g as diffEnvelopes, m as diffFsTrees, f as envelopesEqual, l as filterByRole, j as generateFsTree } from './envelope-DD7v0v6E.js';
5
+ import { IRWorkflowDefinition, PureFormWorkflow, IRDataSource, IRExperienceNode as IRExperienceNode$1 } from '@mmapp/player-core';
6
+ export { B as BuildOptions, d as BuildResult, a as DevServerInstance, D as DevServerOptions, b as build, c as createDevServer } from './dev-server-CrQ041KP.js';
7
+ import { F as FileRole } from './envelope-ChEkuHij.js';
8
+ export { B as BuildEnvelopeOptions, c as BuildEnvelopeResult, a as EnvelopeFile, E as EnvelopeManifest, i as EnvelopeMetadata, n as FsTree, o as FsTreeEntry, h as SourceBinding, S as SourceEnvelope, b as buildEnvelope, e as computeEnvelopeId, d as createSourceEnvelope, k as detectFileRole, g as diffEnvelopes, m as diffFsTrees, f as envelopesEqual, l as filterByRole, j as generateFsTree } from './envelope-ChEkuHij.js';
9
9
  import 'vite';
10
10
 
11
11
  /**
@@ -425,7 +425,7 @@ declare function decompile(definition: DecompilerInput, options?: DecompileOptio
425
425
  * - useQuery/useMutation data sources
426
426
  * - JSX return tree from experience nodes
427
427
  * - @workflow JSDoc header
428
- * - Proper imports from @mindmatrix/react
428
+ * - Proper imports from @mmapp/react
429
429
  *
430
430
  * @param definition - The IR workflow definition (with optional experience tree).
431
431
  * @param options - Decompile options (componentName, includeAnnotation, etc.).
@@ -499,7 +499,7 @@ declare function extractComputed(path: NodePath<t.CallExpression>, state: any):
499
499
  /**
500
500
  * Babel Visitor — main AST traversal logic for extracting workflow definitions.
501
501
  *
502
- * Handles all @mindmatrix/react hooks:
502
+ * Handles all @mmapp/react hooks:
503
503
  * - useState → fields
504
504
  * - useOnEnter / useOnExit → state enter/exit actions
505
505
  * - useTransition → transitions