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

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/babel/index.d.mts +2 -2
  2. package/dist/babel/index.d.ts +2 -2
  3. package/dist/babel/index.js +5 -5
  4. package/dist/babel/index.mjs +1 -1
  5. package/dist/cli/index.js +797 -1941
  6. package/dist/cli/index.mjs +179 -77
  7. package/dist/codemod/cli.js +1 -1
  8. package/dist/codemod/cli.mjs +1 -1
  9. package/dist/codemod/index.d.mts +3 -3
  10. package/dist/codemod/index.d.ts +3 -3
  11. package/dist/codemod/index.js +1 -1
  12. package/dist/codemod/index.mjs +1 -1
  13. package/dist/dev-server.d.mts +2 -2
  14. package/dist/dev-server.d.ts +2 -2
  15. package/dist/dev-server.js +86 -1218
  16. package/dist/dev-server.mjs +4 -4
  17. package/dist/envelope.d.mts +2 -2
  18. package/dist/envelope.d.ts +2 -2
  19. package/dist/envelope.js +5 -5
  20. package/dist/envelope.mjs +2 -2
  21. package/dist/index.d.mts +8 -8
  22. package/dist/index.d.ts +8 -8
  23. package/dist/index.js +342 -1266
  24. package/dist/index.mjs +8 -8
  25. package/dist/testing/index.d.mts +8 -8
  26. package/dist/testing/index.d.ts +8 -8
  27. package/dist/testing/index.js +5 -5
  28. package/dist/testing/index.mjs +1 -1
  29. package/dist/vite/index.d.mts +1 -1
  30. package/dist/vite/index.d.ts +1 -1
  31. package/dist/vite/index.js +5 -5
  32. package/dist/vite/index.mjs +2 -2
  33. package/examples/authentication/main.workflow.tsx +1 -1
  34. package/examples/authentication/mm.config.ts +1 -1
  35. package/examples/authentication/pages/LoginPage.tsx +2 -2
  36. package/examples/authentication/pages/SignupPage.tsx +2 -2
  37. package/examples/counter.workflow.tsx +1 -1
  38. package/examples/dashboard.workflow.tsx +1 -1
  39. package/examples/invoice-approval/actions/invoice.server.ts +1 -1
  40. package/examples/invoice-approval/main.workflow.tsx +1 -1
  41. package/examples/invoice-approval/mm.config.ts +1 -1
  42. package/examples/invoice-approval/pages/InvoiceDetailPage.tsx +1 -1
  43. package/examples/invoice-approval/pages/InvoiceFormPage.tsx +1 -1
  44. package/examples/invoice-approval/pages/InvoiceListPage.tsx +1 -1
  45. package/examples/todo-app.workflow.tsx +1 -1
  46. package/examples/uber-app/actions/matching.server.ts +1 -1
  47. package/examples/uber-app/actions/notifications.server.ts +1 -1
  48. package/examples/uber-app/actions/payments.server.ts +1 -1
  49. package/examples/uber-app/actions/pricing.server.ts +1 -1
  50. package/examples/uber-app/app/admin/analytics.tsx +2 -2
  51. package/examples/uber-app/app/admin/fleet.tsx +2 -2
  52. package/examples/uber-app/app/admin/surge-pricing.tsx +2 -2
  53. package/examples/uber-app/app/driver/dashboard.tsx +2 -2
  54. package/examples/uber-app/app/driver/earnings.tsx +2 -2
  55. package/examples/uber-app/app/driver/navigation.tsx +2 -2
  56. package/examples/uber-app/app/driver/ride-acceptance.tsx +2 -2
  57. package/examples/uber-app/app/rider/home.tsx +2 -2
  58. package/examples/uber-app/app/rider/payment-methods.tsx +2 -2
  59. package/examples/uber-app/app/rider/ride-history.tsx +2 -2
  60. package/examples/uber-app/app/rider/ride-tracking.tsx +2 -2
  61. package/examples/uber-app/components/DriverCard.tsx +1 -1
  62. package/examples/uber-app/components/MapView.tsx +3 -3
  63. package/examples/uber-app/components/RatingStars.tsx +2 -2
  64. package/examples/uber-app/components/RideCard.tsx +1 -1
  65. package/examples/uber-app/mm.config.ts +1 -1
  66. package/examples/uber-app/workflows/dispute-resolution.workflow.tsx +2 -2
  67. package/examples/uber-app/workflows/driver-onboarding.workflow.tsx +2 -2
  68. package/examples/uber-app/workflows/payment-processing.workflow.tsx +2 -2
  69. package/examples/uber-app/workflows/ride-request.workflow.tsx +2 -2
  70. package/package.json +13 -9
  71. package/dist/auth-3UK75242.mjs +0 -17
  72. package/dist/chunk-5FTDWKHH.mjs +0 -244
  73. package/dist/chunk-7JRAEFRB.mjs +0 -7510
  74. package/dist/chunk-7T6Q5KAA.mjs +0 -7506
  75. package/dist/chunk-ABYPKRSB.mjs +0 -215
  76. package/dist/chunk-BZEXUPDH.mjs +0 -175
  77. package/dist/chunk-HRYR54PT.mjs +0 -175
  78. package/dist/chunk-J3M4GUS7.mjs +0 -161
  79. package/dist/chunk-JRGFBWTN.mjs +0 -2918
  80. package/dist/chunk-O4AUS7EU.mjs +0 -148
  81. package/dist/chunk-R2DD5GTY.mjs +0 -186
  82. package/dist/chunk-UDDTWG5J.mjs +0 -734
  83. package/dist/chunk-VLTKQDJ3.mjs +0 -244
  84. package/dist/chunk-WVYY32LD.mjs +0 -939
  85. package/dist/chunk-XDVM4YHX.mjs +0 -3450
  86. package/dist/chunk-Z2G5RZ4H.mjs +0 -186
  87. package/dist/chunk-ZE3KCHBM.mjs +0 -2918
  88. package/dist/deploy-YAJGW6II.mjs +0 -9
  89. package/dist/dev-server-CrQ041KP.d.mts +0 -79
  90. package/dist/dev-server-CrQ041KP.d.ts +0 -79
  91. package/dist/envelope-ChEkuHij.d.mts +0 -265
  92. package/dist/envelope-ChEkuHij.d.ts +0 -265
  93. package/dist/index-CEKyyazf.d.mts +0 -104
  94. package/dist/index-CEKyyazf.d.ts +0 -104
  95. package/dist/init-7FJENUDK.mjs +0 -407
  96. package/dist/project-compiler-NNK32MPG.mjs +0 -10
  97. package/dist/project-compiler-ZB4RUYVL.mjs +0 -10
  98. package/dist/project-decompiler-U55HQUHW.mjs +0 -7
  99. package/dist/pull-KOL2QAYQ.mjs +0 -109
  100. package/dist/seed-KOGEPGOJ.mjs +0 -154
  101. package/dist/server-VW6UPCHO.mjs +0 -277
  102. package/dist/verify-BYHUKARQ.mjs +0 -1833
  103. package/dist/verify-OQDEQYMS.mjs +0 -1833
@@ -1,161 +0,0 @@
1
- import {
2
- __require
3
- } from "./chunk-CIESM3BP.mjs";
4
-
5
- // src/cli/auth.ts
6
- import { readFileSync, writeFileSync, mkdirSync, existsSync, unlinkSync } from "fs";
7
- import { join } from "path";
8
- import { homedir } from "os";
9
- import { createInterface } from "readline";
10
- var MMRC_DIR = join(homedir(), ".mmrc");
11
- var CREDENTIALS_PATH = join(MMRC_DIR, "credentials.json");
12
- function loadCredentials() {
13
- if (!existsSync(CREDENTIALS_PATH)) return {};
14
- try {
15
- return JSON.parse(readFileSync(CREDENTIALS_PATH, "utf-8"));
16
- } catch {
17
- return {};
18
- }
19
- }
20
- function saveCredentials(apiUrl, token) {
21
- mkdirSync(MMRC_DIR, { recursive: true, mode: 448 });
22
- const creds = loadCredentials();
23
- creds[apiUrl] = { token, savedAt: (/* @__PURE__ */ new Date()).toISOString() };
24
- writeFileSync(CREDENTIALS_PATH, JSON.stringify(creds, null, 2), "utf-8");
25
- try {
26
- const { chmodSync } = __require("fs");
27
- chmodSync(CREDENTIALS_PATH, 384);
28
- } catch {
29
- }
30
- }
31
- function removeCredentials(apiUrl) {
32
- if (!existsSync(CREDENTIALS_PATH)) return;
33
- if (!apiUrl) {
34
- unlinkSync(CREDENTIALS_PATH);
35
- return;
36
- }
37
- const creds = loadCredentials();
38
- delete creds[apiUrl];
39
- if (Object.keys(creds).length === 0) {
40
- unlinkSync(CREDENTIALS_PATH);
41
- } else {
42
- writeFileSync(CREDENTIALS_PATH, JSON.stringify(creds, null, 2), "utf-8");
43
- }
44
- }
45
- function resolveToken(apiUrl, explicitToken) {
46
- if (explicitToken) return explicitToken;
47
- const envToken = process.env.MMRC_TOKEN;
48
- if (envToken) return envToken;
49
- const creds = loadCredentials();
50
- const entry = creds[apiUrl];
51
- if (entry?.token) return entry.token;
52
- return null;
53
- }
54
- function prompt(question, hidden = false) {
55
- return new Promise((resolve) => {
56
- const rl = createInterface({
57
- input: process.stdin,
58
- output: process.stdout
59
- });
60
- if (hidden && process.stdin.isTTY) {
61
- const origWrite = process.stdout.write.bind(process.stdout);
62
- process.stdout.write = ((chunk, encodingOrCb, cb) => {
63
- if (typeof chunk === "string" && chunk.includes(question)) {
64
- return origWrite(chunk, encodingOrCb, cb);
65
- }
66
- if (typeof chunk === "string" && !chunk.includes("\n")) {
67
- return true;
68
- }
69
- return origWrite(chunk, encodingOrCb, cb);
70
- });
71
- rl.question(question, (answer) => {
72
- process.stdout.write = origWrite;
73
- console.log();
74
- rl.close();
75
- resolve(answer.trim());
76
- });
77
- } else {
78
- rl.question(question, (answer) => {
79
- rl.close();
80
- resolve(answer.trim());
81
- });
82
- }
83
- });
84
- }
85
- async function login(apiUrl, email, password) {
86
- if (!email) {
87
- email = await prompt("Email: ");
88
- }
89
- if (!password) {
90
- password = await prompt("Password: ", true);
91
- }
92
- if (!email || !password) {
93
- throw new Error("Email and password are required");
94
- }
95
- console.log(`[mmrc] Logging in to ${apiUrl}...`);
96
- const res = await fetch(`${apiUrl}/auth/login`, {
97
- method: "POST",
98
- headers: { "Content-Type": "application/json" },
99
- body: JSON.stringify({ email, password })
100
- });
101
- if (!res.ok) {
102
- const text = await res.text();
103
- throw new Error(`Login failed: ${res.status} ${text}`);
104
- }
105
- const data = await res.json();
106
- const token = data.token ?? data.access_token ?? data.accessToken;
107
- if (!token) {
108
- throw new Error("Login succeeded but no token in response");
109
- }
110
- saveCredentials(apiUrl, token);
111
- const userName = data.name ?? data.user?.name ?? data.user?.email ?? email;
112
- console.log(`[mmrc] Logged in as ${userName}`);
113
- console.log(`[mmrc] Token saved to ${CREDENTIALS_PATH}`);
114
- return token;
115
- }
116
- function logout(apiUrl) {
117
- if (apiUrl) {
118
- removeCredentials(apiUrl);
119
- console.log(`[mmrc] Credentials removed for ${apiUrl}`);
120
- } else {
121
- removeCredentials();
122
- console.log("[mmrc] All saved credentials removed");
123
- }
124
- }
125
- async function whoami(apiUrl) {
126
- const token = resolveToken(apiUrl);
127
- if (!token) {
128
- console.log("[mmrc] Not logged in. Run `mmrc login` to authenticate.");
129
- return;
130
- }
131
- try {
132
- const res = await fetch(`${apiUrl}/auth/me`, {
133
- headers: { Authorization: `Bearer ${token}` }
134
- });
135
- if (!res.ok) {
136
- if (res.status === 401) {
137
- console.log("[mmrc] Token is expired or invalid. Run `mmrc login` to re-authenticate.");
138
- return;
139
- }
140
- console.log(`[mmrc] Failed to fetch user info: ${res.status}`);
141
- return;
142
- }
143
- const user = await res.json();
144
- console.log(`[mmrc] Logged in to ${apiUrl}`);
145
- console.log(` Name: ${user.name ?? "(unknown)"}`);
146
- console.log(` Email: ${user.email ?? "(unknown)"}`);
147
- if (user.id) console.log(` ID: ${user.id}`);
148
- if (user.role) console.log(` Role: ${user.role}`);
149
- } catch (error) {
150
- console.log(`[mmrc] Could not connect to ${apiUrl}: ${error.message}`);
151
- }
152
- }
153
-
154
- export {
155
- loadCredentials,
156
- saveCredentials,
157
- resolveToken,
158
- login,
159
- logout,
160
- whoami
161
- };