zitejs 0.10.0-start.8 → 0.10.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.
Files changed (417) hide show
  1. package/dist/cjs/auth/actions.d.ts +28 -0
  2. package/dist/cjs/auth/actions.js +93 -0
  3. package/dist/cjs/auth/client.d.ts +357 -0
  4. package/dist/cjs/auth/client.js +66 -0
  5. package/dist/cjs/auth/config.js +9 -3
  6. package/dist/cjs/auth/index.d.ts +2 -249
  7. package/dist/cjs/auth/index.js +11 -108
  8. package/dist/cjs/auth/index.test.js +60 -0
  9. package/dist/cjs/auth/previewClaim.d.ts +7 -0
  10. package/dist/cjs/auth/previewClaim.js +16 -0
  11. package/dist/cjs/auth/profileUpdates.d.ts +9 -0
  12. package/dist/cjs/auth/profileUpdates.js +11 -0
  13. package/dist/cjs/backend/index.d.ts +15 -9
  14. package/dist/cjs/backend/index.js +13 -13
  15. package/dist/cjs/backend/index.test.js +102 -102
  16. package/dist/cjs/bundle/index.d.ts +8 -0
  17. package/dist/cjs/bundle/index.js +38 -24
  18. package/dist/cjs/caller/index.js +43 -43
  19. package/dist/cjs/check/index.d.ts +44 -1
  20. package/dist/cjs/check/index.js +188 -113
  21. package/dist/cjs/check/start/routeTree.d.ts +8 -0
  22. package/dist/cjs/check/start/routeTree.js +118 -0
  23. package/dist/cjs/check/start/tsgo.d.ts +2 -0
  24. package/dist/cjs/check/start/tsgo.js +35 -0
  25. package/dist/cjs/cli.js +10 -4
  26. package/dist/cjs/client/index.d.ts +26 -2
  27. package/dist/cjs/client/index.js +25 -25
  28. package/dist/cjs/dev/index.js +79 -54
  29. package/dist/cjs/dev/signin.d.ts +16 -0
  30. package/dist/cjs/dev/signin.js +84 -0
  31. package/dist/cjs/index.d.ts +5 -5
  32. package/dist/cjs/integrations/client.d.ts +3 -3
  33. package/dist/cjs/integrations/client.js +5 -4
  34. package/dist/cjs/integrations/client.test-d.js +15 -15
  35. package/dist/cjs/integrations/index.d.ts +2 -2
  36. package/dist/cjs/integrations/rules.d.ts +1 -0
  37. package/dist/cjs/integrations/rules.js +48 -43
  38. package/dist/cjs/integrations/rules.test.js +60 -54
  39. package/dist/cjs/internal/appMode.d.ts +14 -0
  40. package/dist/cjs/internal/appMode.js +19 -0
  41. package/dist/cjs/internal/env.js +3 -2
  42. package/dist/cjs/internal/platformFetch.d.ts +2 -0
  43. package/dist/cjs/internal/platformFetch.js +14 -0
  44. package/dist/cjs/internal/reservedIds.d.ts +8 -0
  45. package/dist/cjs/internal/reservedIds.js +14 -0
  46. package/dist/cjs/internal/serviceUrls.d.ts +5 -0
  47. package/dist/cjs/internal/serviceUrls.js +14 -0
  48. package/dist/cjs/pdf/index.js +2 -1
  49. package/dist/cjs/runtime/filterConditionTypes.test-d.js +11 -11
  50. package/dist/cjs/runtime/index.d.ts +126 -39
  51. package/dist/cjs/runtime/index.js +32 -26
  52. package/dist/cjs/runtime/index.test.js +34 -34
  53. package/dist/cjs/runtime/sendEmailParamsTypes.test-d.js +50 -0
  54. package/dist/cjs/runtime/writeResultTypes.test-d.js +8 -8
  55. package/dist/cjs/sourceRoots.js +15 -15
  56. package/dist/cjs/sourceRoots.test.js +29 -27
  57. package/dist/cjs/start/{entries.d.ts → build/entries.d.ts} +9 -4
  58. package/dist/cjs/start/{entries.js → build/entries.js} +38 -21
  59. package/dist/cjs/start/build/placeholders/devApp.d.ts +1 -0
  60. package/dist/cjs/start/build/placeholders/devApp.js +6 -0
  61. package/dist/{esm/start → cjs/start/describe}/describeBuilt.d.ts +2 -0
  62. package/dist/cjs/start/{describeBuilt.js → describe/describeBuilt.js} +55 -17
  63. package/dist/cjs/start/platform/aiUsage.d.ts +29 -0
  64. package/dist/cjs/start/platform/aiUsage.js +215 -0
  65. package/dist/cjs/start/platform/airtable/cache.d.ts +17 -0
  66. package/dist/cjs/start/platform/airtable/cache.js +93 -0
  67. package/dist/cjs/start/protocol.d.ts +19 -0
  68. package/dist/cjs/start/protocol.js +33 -0
  69. package/dist/cjs/start/serve/local/provider.d.ts +25 -0
  70. package/dist/cjs/start/serve/local/provider.js +196 -0
  71. package/dist/cjs/start/serve/provider.d.ts +19 -0
  72. package/dist/cjs/start/serve/provider.js +86 -0
  73. package/dist/cjs/start/types.d.ts +373 -0
  74. package/dist/cjs/start/types.js +2 -0
  75. package/dist/cjs/steps/index.d.ts +78 -0
  76. package/dist/cjs/steps/index.js +507 -0
  77. package/dist/cjs/steps/index.test.js +635 -0
  78. package/dist/cjs/sync/index.d.ts +1 -1
  79. package/dist/cjs/sync/index.js +28 -27
  80. package/dist/cjs/sync/lib.d.ts +15 -8
  81. package/dist/cjs/sync/lib.js +655 -655
  82. package/dist/cjs/sync/lib.test.js +177 -46
  83. package/dist/cjs/sync/sdkNames.d.ts +67 -9
  84. package/dist/cjs/sync/sdkNames.js +97 -31
  85. package/dist/cjs/sync/sdkNames.test.js +189 -113
  86. package/dist/cjs/types/fields.d.ts +9 -2
  87. package/dist/cjs/types/fields.js +110 -96
  88. package/dist/cjs/types/index.d.ts +2 -2
  89. package/dist/cjs/types/tables.d.ts +17 -1
  90. package/dist/cjs/upload/index.js +89 -24
  91. package/dist/cjs/upload/index.test.js +104 -1
  92. package/dist/cjs/vite/domTagNames.js +252 -252
  93. package/dist/cjs/vite/index.d.ts +1 -1
  94. package/dist/cjs/vite/index.js +46 -42
  95. package/dist/esm/auth/actions.d.ts +28 -0
  96. package/dist/esm/auth/actions.js +55 -0
  97. package/dist/esm/auth/client.d.ts +357 -0
  98. package/dist/esm/auth/client.js +62 -0
  99. package/dist/esm/auth/config.js +9 -3
  100. package/dist/esm/auth/index.d.ts +2 -249
  101. package/dist/esm/auth/index.js +2 -103
  102. package/dist/esm/auth/index.test.js +60 -0
  103. package/dist/esm/auth/previewClaim.d.ts +7 -0
  104. package/dist/esm/auth/previewClaim.js +12 -0
  105. package/dist/esm/auth/profileUpdates.d.ts +9 -0
  106. package/dist/esm/auth/profileUpdates.js +6 -0
  107. package/dist/esm/backend/index.d.ts +15 -9
  108. package/dist/esm/backend/index.js +13 -13
  109. package/dist/esm/backend/index.test.js +106 -106
  110. package/dist/esm/bundle/index.d.ts +8 -0
  111. package/dist/esm/bundle/index.js +37 -24
  112. package/dist/esm/caller/index.js +44 -44
  113. package/dist/esm/check/index.d.ts +44 -1
  114. package/dist/esm/check/index.js +187 -116
  115. package/dist/esm/check/start/routeTree.d.ts +8 -0
  116. package/dist/esm/check/start/routeTree.js +77 -0
  117. package/dist/esm/check/start/tsgo.d.ts +2 -0
  118. package/dist/esm/check/start/tsgo.js +29 -0
  119. package/dist/esm/cli.js +10 -4
  120. package/dist/esm/client/index.d.ts +26 -2
  121. package/dist/esm/client/index.js +25 -25
  122. package/dist/esm/dev/index.js +86 -61
  123. package/dist/esm/dev/signin.d.ts +16 -0
  124. package/dist/esm/dev/signin.js +80 -0
  125. package/dist/esm/index.d.ts +5 -5
  126. package/dist/esm/index.js +3 -3
  127. package/dist/esm/integrations/client.d.ts +3 -3
  128. package/dist/esm/integrations/client.js +6 -5
  129. package/dist/esm/integrations/client.test-d.js +19 -19
  130. package/dist/esm/integrations/index.d.ts +2 -2
  131. package/dist/esm/integrations/index.js +1 -1
  132. package/dist/esm/integrations/rules.d.ts +1 -0
  133. package/dist/esm/integrations/rules.js +48 -43
  134. package/dist/esm/integrations/rules.test.js +62 -56
  135. package/dist/esm/internal/appMode.d.ts +14 -0
  136. package/dist/esm/internal/appMode.js +13 -0
  137. package/dist/esm/internal/env.js +3 -2
  138. package/dist/esm/internal/platformFetch.d.ts +2 -0
  139. package/dist/esm/internal/platformFetch.js +9 -0
  140. package/dist/esm/internal/reservedIds.d.ts +8 -0
  141. package/dist/esm/internal/reservedIds.js +10 -0
  142. package/dist/esm/internal/serviceUrls.d.ts +5 -0
  143. package/dist/esm/internal/serviceUrls.js +10 -0
  144. package/dist/esm/pdf/index.js +2 -1
  145. package/dist/esm/runtime/filterConditionTypes.test-d.js +12 -12
  146. package/dist/esm/runtime/index.d.ts +126 -39
  147. package/dist/esm/runtime/index.js +35 -29
  148. package/dist/esm/runtime/index.test.js +36 -36
  149. package/dist/esm/runtime/sendEmailParamsTypes.test-d.d.ts +1 -0
  150. package/dist/esm/runtime/sendEmailParamsTypes.test-d.js +48 -0
  151. package/dist/esm/runtime/writeResultTypes.test-d.js +9 -9
  152. package/dist/esm/signin/conformance.d.ts +100 -0
  153. package/dist/esm/signin/conformance.js +616 -0
  154. package/dist/esm/signin/cookies.d.ts +28 -0
  155. package/dist/esm/signin/cookies.js +67 -0
  156. package/dist/esm/signin/encoding.d.ts +1 -0
  157. package/dist/esm/signin/encoding.js +12 -0
  158. package/dist/esm/signin/endpoints.d.ts +12 -0
  159. package/dist/esm/signin/endpoints.js +32 -0
  160. package/dist/esm/signin/http.d.ts +25 -0
  161. package/dist/esm/signin/http.js +106 -0
  162. package/dist/esm/signin/index.d.ts +8 -0
  163. package/dist/esm/signin/index.js +9 -0
  164. package/dist/esm/signin/keys.d.ts +35 -0
  165. package/dist/esm/signin/keys.js +230 -0
  166. package/dist/esm/signin/paths.d.ts +2 -0
  167. package/dist/esm/signin/paths.js +5 -0
  168. package/dist/esm/signin/seal.d.ts +19 -0
  169. package/dist/esm/signin/seal.js +47 -0
  170. package/dist/esm/signin/signin.d.ts +60 -0
  171. package/dist/esm/signin/signin.js +447 -0
  172. package/dist/esm/signin/transport.d.ts +112 -0
  173. package/dist/esm/signin/transport.js +1 -0
  174. package/dist/esm/signin/verifier.d.ts +2 -0
  175. package/dist/esm/signin/verifier.js +4 -0
  176. package/dist/esm/signin/verify.d.ts +83 -0
  177. package/dist/esm/signin/verify.js +142 -0
  178. package/dist/esm/sourceRoots.js +17 -17
  179. package/dist/esm/sourceRoots.test.js +34 -32
  180. package/dist/esm/start/access.d.ts +19 -0
  181. package/dist/esm/start/access.js +43 -0
  182. package/dist/esm/start/auth.d.ts +28 -0
  183. package/dist/esm/start/auth.js +33 -0
  184. package/dist/esm/start/automations/quiet.d.ts +2 -0
  185. package/dist/esm/start/automations/quiet.js +36 -0
  186. package/dist/esm/start/{registration.d.ts → automations/registration.d.ts} +1 -1
  187. package/dist/esm/start/{registration.js → automations/registration.js} +11 -7
  188. package/dist/esm/start/automations/steps.d.ts +29 -0
  189. package/dist/esm/start/automations/steps.js +95 -0
  190. package/dist/esm/start/automations/workflow.d.ts +83 -0
  191. package/dist/esm/start/automations/workflow.js +36 -0
  192. package/dist/esm/start/automations/workflow.test-d.d.ts +1 -0
  193. package/dist/esm/start/automations/workflow.test-d.js +130 -0
  194. package/dist/esm/start/automations/workflowRun.d.ts +130 -0
  195. package/dist/esm/start/automations/workflowRun.js +185 -0
  196. package/dist/esm/start/barrel.test-d.d.ts +10 -0
  197. package/dist/esm/start/barrel.test-d.js +6 -0
  198. package/dist/esm/start/{entries.d.ts → build/entries.d.ts} +9 -4
  199. package/dist/esm/start/{entries.js → build/entries.js} +38 -22
  200. package/dist/esm/start/build/placeholders/devApp.d.ts +1 -0
  201. package/dist/esm/start/build/placeholders/devApp.js +3 -0
  202. package/dist/esm/start/build/placeholders/devSignIn.d.ts +1 -0
  203. package/dist/esm/start/build/placeholders/devSignIn.js +3 -0
  204. package/dist/esm/start/build/placeholders/siteHead.d.ts +2 -0
  205. package/dist/esm/start/build/placeholders/siteHead.js +3 -0
  206. package/dist/esm/start/{workflowModules.js → build/placeholders/workflowModules.js} +1 -1
  207. package/dist/esm/start/build/placeholders/workspaceSchema.d.ts +2 -0
  208. package/dist/esm/start/build/placeholders/workspaceSchema.js +3 -0
  209. package/dist/esm/start/build/registrationHash.d.ts +11 -0
  210. package/dist/esm/start/build/registrationHash.js +88 -0
  211. package/dist/esm/start/build/sdk/axios.d.ts +76 -0
  212. package/dist/esm/start/build/sdk/axios.js +253 -0
  213. package/dist/esm/start/build/sdk/nodeFetch.d.ts +41 -0
  214. package/dist/esm/start/build/sdk/nodeFetch.js +35 -0
  215. package/dist/esm/start/build/sdk/undici.d.ts +34 -0
  216. package/dist/esm/start/build/sdk/undici.js +18 -0
  217. package/dist/esm/start/build/sdkPatches.d.ts +22 -0
  218. package/dist/esm/start/build/sdkPatches.js +430 -0
  219. package/dist/esm/start/build/siteHead.d.ts +26 -0
  220. package/dist/esm/start/build/siteHead.js +88 -0
  221. package/dist/esm/start/build/vite.d.ts +50 -0
  222. package/dist/esm/start/build/vite.js +487 -0
  223. package/dist/esm/start/classicOnly.d.ts +1 -0
  224. package/dist/esm/start/classicOnly.js +4 -0
  225. package/dist/esm/start/describe/describe.d.ts +120 -0
  226. package/dist/esm/start/describe/describe.js +372 -0
  227. package/dist/{cjs/start → esm/start/describe}/describeBuilt.d.ts +2 -0
  228. package/dist/esm/start/describe/describeBuilt.js +102 -0
  229. package/dist/esm/start/{descriptions.js → describe/descriptions.js} +17 -10
  230. package/dist/esm/start/errors.d.ts +20 -4
  231. package/dist/esm/start/errors.js +90 -26
  232. package/dist/esm/start/errors.test.js +47 -16
  233. package/dist/esm/start/factories.d.ts +14 -0
  234. package/dist/esm/start/factories.js +23 -0
  235. package/dist/esm/start/factories.test-d.d.ts +2 -0
  236. package/dist/esm/start/factories.test-d.js +60 -0
  237. package/dist/esm/start/failures.d.ts +7 -0
  238. package/dist/esm/start/failures.js +62 -0
  239. package/dist/esm/start/fnFactory.d.ts +16 -0
  240. package/dist/esm/start/fnFactory.js +1 -0
  241. package/dist/esm/start/host.d.ts +2 -2
  242. package/dist/esm/start/host.js +3 -3
  243. package/dist/esm/start/index.d.ts +10 -63
  244. package/dist/esm/start/index.js +7 -149
  245. package/dist/esm/start/login.d.ts +5 -0
  246. package/dist/esm/start/login.js +29 -0
  247. package/dist/esm/start/middlewareKind.d.ts +13 -0
  248. package/dist/esm/start/middlewareKind.js +9 -0
  249. package/dist/esm/start/platform/aiUsage.d.ts +29 -0
  250. package/dist/esm/start/platform/aiUsage.js +210 -0
  251. package/dist/esm/start/platform/airtable/built.d.ts +2 -0
  252. package/dist/esm/start/platform/airtable/built.js +3 -0
  253. package/dist/esm/start/platform/airtable/cache.d.ts +17 -0
  254. package/dist/esm/start/platform/airtable/cache.js +89 -0
  255. package/dist/esm/start/{airtable → platform/airtable}/dispatch.d.ts +5 -2
  256. package/dist/esm/start/{airtable → platform/airtable}/dispatch.js +195 -119
  257. package/dist/esm/start/{airtable → platform/airtable}/formulas.d.ts +2 -1
  258. package/dist/esm/start/{airtable → platform/airtable}/formulas.js +51 -25
  259. package/dist/esm/start/platform/airtable/index.d.ts +6 -0
  260. package/dist/esm/start/platform/airtable/index.js +51 -0
  261. package/dist/esm/start/platform/airtable/settings.d.ts +37 -0
  262. package/dist/esm/start/platform/airtable/settings.js +138 -0
  263. package/dist/esm/start/platform/analytics.d.ts +3 -0
  264. package/dist/esm/start/platform/analytics.js +59 -0
  265. package/dist/esm/start/platform/calls.d.ts +5 -0
  266. package/dist/esm/start/platform/calls.js +104 -0
  267. package/dist/esm/start/platform/caps.d.ts +9 -0
  268. package/dist/esm/start/platform/caps.js +35 -0
  269. package/dist/esm/start/platform/connections.d.ts +25 -0
  270. package/dist/esm/start/platform/connections.js +198 -0
  271. package/dist/esm/start/{data → platform/data}/baseRunner.d.ts +11 -6
  272. package/dist/esm/start/platform/data/baseRunner.js +117 -0
  273. package/dist/esm/start/{data → platform/data}/dispatch.d.ts +3 -2
  274. package/dist/esm/start/{data → platform/data}/dispatch.js +69 -51
  275. package/dist/esm/start/platform/data/fetch.d.ts +7 -0
  276. package/dist/esm/start/platform/data/fetch.js +9 -0
  277. package/dist/esm/start/platform/data/index.d.ts +27 -0
  278. package/dist/esm/start/platform/data/index.js +75 -0
  279. package/dist/esm/start/platform/data/names.d.ts +7 -0
  280. package/dist/esm/start/platform/data/names.js +18 -0
  281. package/dist/esm/start/{data → platform/data}/transformations.d.ts +0 -31
  282. package/dist/esm/start/{data → platform/data}/transformations.js +0 -56
  283. package/dist/esm/start/{data → platform/data}/types.d.ts +4 -1
  284. package/dist/esm/start/{data → platform/data}/types.js +2 -2
  285. package/dist/esm/start/platform/local.d.ts +6 -0
  286. package/dist/esm/start/platform/local.js +18 -0
  287. package/dist/esm/start/platform/meta.d.ts +3 -0
  288. package/dist/esm/start/platform/meta.js +33 -0
  289. package/dist/esm/start/platform/outbound.d.ts +17 -0
  290. package/dist/esm/start/platform/outbound.js +510 -0
  291. package/dist/esm/start/platform/redactSecrets.d.ts +13 -0
  292. package/dist/esm/start/{redactSecrets.js → platform/redactSecrets.js} +32 -7
  293. package/dist/esm/start/platform/redactSecrets.test.d.ts +1 -0
  294. package/dist/esm/start/platform/requestSecrets.d.ts +15 -0
  295. package/dist/esm/start/platform/requestSecrets.js +41 -0
  296. package/dist/esm/start/platform/runLog.d.ts +40 -0
  297. package/dist/esm/start/platform/runLog.js +149 -0
  298. package/dist/esm/start/platform/services.d.ts +7 -0
  299. package/dist/esm/start/platform/services.js +46 -0
  300. package/dist/esm/start/platform/steps.d.ts +9 -0
  301. package/dist/esm/start/platform/steps.js +60 -0
  302. package/dist/esm/start/platform/telemetry.d.ts +13 -0
  303. package/dist/esm/start/platform/telemetry.js +71 -0
  304. package/dist/esm/start/platform/transport.d.ts +28 -0
  305. package/dist/esm/start/platform/transport.js +59 -0
  306. package/dist/esm/start/platformHead.d.ts +23 -0
  307. package/dist/esm/start/platformHead.js +133 -0
  308. package/dist/esm/start/previewClaim.d.ts +3 -7
  309. package/dist/esm/start/previewClaim.js +9 -17
  310. package/dist/esm/start/protocol.d.ts +19 -0
  311. package/dist/esm/start/protocol.js +27 -0
  312. package/dist/esm/start/roles.d.ts +12 -0
  313. package/dist/esm/start/roles.js +27 -0
  314. package/dist/esm/start/router.d.ts +28 -4
  315. package/dist/esm/start/router.js +224 -21
  316. package/dist/esm/start/serve/authHooks.js +18 -0
  317. package/dist/esm/start/serve/demo.d.ts +9 -0
  318. package/dist/esm/start/serve/demo.js +24 -0
  319. package/dist/esm/start/serve/fetch.d.ts +1 -0
  320. package/dist/esm/start/serve/fetch.js +6 -0
  321. package/dist/esm/start/{instance.d.ts → serve/instance.d.ts} +6 -5
  322. package/dist/esm/start/serve/instance.js +134 -0
  323. package/dist/esm/start/serve/invoke.d.ts +13 -0
  324. package/dist/esm/start/serve/invoke.js +126 -0
  325. package/dist/esm/start/serve/local/load.d.ts +8 -0
  326. package/dist/esm/start/serve/local/load.js +44 -0
  327. package/dist/esm/start/serve/local/provider.d.ts +25 -0
  328. package/dist/esm/start/serve/local/provider.js +188 -0
  329. package/dist/esm/start/serve/local/signIn.d.ts +28 -0
  330. package/dist/esm/start/serve/local/signIn.js +123 -0
  331. package/dist/esm/start/serve/pageHead.d.ts +20 -0
  332. package/dist/esm/start/serve/pageHead.js +34 -0
  333. package/dist/esm/start/serve/provider.d.ts +19 -0
  334. package/dist/esm/start/serve/provider.js +78 -0
  335. package/dist/esm/start/serve/requestEnv.d.ts +2 -0
  336. package/dist/esm/start/serve/requestEnv.js +84 -0
  337. package/dist/esm/start/serve/scope.d.ts +18 -0
  338. package/dist/esm/start/serve/scope.js +67 -0
  339. package/dist/esm/start/serve/server.d.ts +56 -0
  340. package/dist/esm/start/serve/server.js +297 -0
  341. package/dist/esm/start/serve/uploads.d.ts +2 -0
  342. package/dist/esm/start/serve/uploads.js +49 -0
  343. package/dist/esm/start/serve/worker.d.ts +6 -0
  344. package/dist/esm/start/serve/worker.js +12 -0
  345. package/dist/esm/start/types.d.ts +270 -56
  346. package/dist/esm/start/version.d.ts +1 -1
  347. package/dist/esm/start/version.js +1 -1
  348. package/dist/esm/steps/index.d.ts +78 -0
  349. package/dist/esm/steps/index.js +502 -0
  350. package/dist/esm/steps/index.test.d.ts +1 -0
  351. package/dist/esm/steps/index.test.js +633 -0
  352. package/dist/esm/sync/index.d.ts +1 -1
  353. package/dist/esm/sync/index.js +32 -31
  354. package/dist/esm/sync/lib.d.ts +15 -8
  355. package/dist/esm/sync/lib.js +659 -659
  356. package/dist/esm/sync/lib.test.js +177 -46
  357. package/dist/esm/sync/sdkNames.d.ts +67 -9
  358. package/dist/esm/sync/sdkNames.js +94 -30
  359. package/dist/esm/sync/sdkNames.test.js +192 -116
  360. package/dist/esm/types/fields.d.ts +9 -2
  361. package/dist/esm/types/fields.js +110 -96
  362. package/dist/esm/types/index.d.ts +2 -2
  363. package/dist/esm/types/index.js +2 -2
  364. package/dist/esm/types/tables.d.ts +17 -1
  365. package/dist/esm/types/tables.js +2 -2
  366. package/dist/esm/upload/index.js +89 -24
  367. package/dist/esm/upload/index.test.js +104 -1
  368. package/dist/esm/vite/domTagNames.js +252 -252
  369. package/dist/esm/vite/index.d.ts +1 -1
  370. package/dist/esm/vite/index.js +51 -47
  371. package/package.json +95 -37
  372. package/dist/cjs/auth-server/index.d.ts +0 -369
  373. package/dist/cjs/auth-server/index.js +0 -119
  374. package/dist/cjs/start/problems.d.ts +0 -19
  375. package/dist/cjs/start/problems.js +0 -11
  376. package/dist/esm/auth-server/index.d.ts +0 -369
  377. package/dist/esm/auth-server/index.js +0 -116
  378. package/dist/esm/start/airtable/index.d.ts +0 -11
  379. package/dist/esm/start/airtable/index.js +0 -70
  380. package/dist/esm/start/authHooks.js +0 -10
  381. package/dist/esm/start/data/baseRunner.js +0 -83
  382. package/dist/esm/start/data/index.d.ts +0 -18
  383. package/dist/esm/start/data/index.js +0 -76
  384. package/dist/esm/start/describe.d.ts +0 -80
  385. package/dist/esm/start/describe.js +0 -197
  386. package/dist/esm/start/describeBuilt.js +0 -66
  387. package/dist/esm/start/instance.js +0 -80
  388. package/dist/esm/start/problems.d.ts +0 -19
  389. package/dist/esm/start/problems.js +0 -8
  390. package/dist/esm/start/redactSecrets.d.ts +0 -7
  391. package/dist/esm/start/runLog.d.ts +0 -8
  392. package/dist/esm/start/runLog.js +0 -76
  393. package/dist/esm/start/scope.d.ts +0 -15
  394. package/dist/esm/start/scope.js +0 -58
  395. package/dist/esm/start/server.d.ts +0 -55
  396. package/dist/esm/start/server.js +0 -317
  397. package/dist/esm/start/vite.d.ts +0 -9
  398. package/dist/esm/start/vite.js +0 -173
  399. package/dist/esm/start/worker.d.ts +0 -11
  400. package/dist/esm/start/worker.js +0 -20
  401. package/dist/esm/start/workflow.d.ts +0 -50
  402. package/dist/esm/start/workflow.js +0 -13
  403. package/dist/esm/start/workflow.test-d.js +0 -39
  404. package/dist/esm/start/workflowRun.d.ts +0 -80
  405. package/dist/esm/start/workflowRun.js +0 -108
  406. /package/dist/{esm/start/redactSecrets.test.d.ts → cjs/runtime/sendEmailParamsTypes.test-d.d.ts} +0 -0
  407. /package/dist/{esm/start/workflow.test-d.d.ts → cjs/steps/index.test.d.ts} +0 -0
  408. /package/dist/esm/start/{authHooksModule.d.ts → build/placeholders/authHooksModule.d.ts} +0 -0
  409. /package/dist/esm/start/{authHooksModule.js → build/placeholders/authHooksModule.js} +0 -0
  410. /package/dist/esm/start/{workflowModules.d.ts → build/placeholders/workflowModules.d.ts} +0 -0
  411. /package/dist/esm/start/{descriptions.d.ts → describe/descriptions.d.ts} +0 -0
  412. /package/dist/esm/start/{airtable → platform/airtable}/arrayFields.d.ts +0 -0
  413. /package/dist/esm/start/{airtable → platform/airtable}/arrayFields.js +0 -0
  414. /package/dist/esm/start/{data → platform/data}/sqlNameMappings.d.ts +0 -0
  415. /package/dist/esm/start/{data → platform/data}/sqlNameMappings.js +0 -0
  416. /package/dist/esm/start/{redactSecrets.test.js → platform/redactSecrets.test.js} +0 -0
  417. /package/dist/esm/start/{authHooks.d.ts → serve/authHooks.d.ts} +0 -0
@@ -0,0 +1,88 @@
1
+ // The app's Settings off Zite, baked into the server build from its zite.config.json: what the platform sends each
2
+ // request on Zite (restly's startPagePlan and createZiteWebManifest), less the fallbacks only it knows, the app's name,
3
+ // screenshot and brand kit. Keep the two in step.
4
+ import { z } from 'zod';
5
+ const DEFAULT_PWA_BACKGROUND_COLOR = '#ffffff';
6
+ const HEX_COLOR = /^#[0-9A-Fa-f]{6}$/;
7
+ const MAX_SHORT_NAME_LENGTH = 12;
8
+ const text = z.string().optional().catch(undefined);
9
+ const settings = z.object({
10
+ seoSettings: z
11
+ .object({
12
+ title: text,
13
+ description: text,
14
+ thumbnailUrl: text,
15
+ faviconUrl: text,
16
+ })
17
+ .optional()
18
+ .catch(undefined),
19
+ pwaSettings: z
20
+ .object({
21
+ enabled: z.boolean().optional().catch(undefined),
22
+ title: text,
23
+ backgroundColor: text,
24
+ icons: z
25
+ .object({ icon192Url: text, icon512Url: text, appleTouchIconUrl: text })
26
+ .optional()
27
+ .catch(undefined),
28
+ })
29
+ .optional()
30
+ .catch(undefined),
31
+ });
32
+ /** An installable app's manifest: one whose settings name all three icons and that isn't switched off. */
33
+ export const webManifestOf = (pwa, title) => {
34
+ const icons = pwa?.icons;
35
+ if (!pwa ||
36
+ pwa.enabled === false ||
37
+ !icons?.icon192Url ||
38
+ !icons.icon512Url ||
39
+ !icons.appleTouchIconUrl)
40
+ return undefined;
41
+ const name = pwa.title?.trim() || title?.trim() || 'Zite App';
42
+ const background = pwa.backgroundColor && HEX_COLOR.test(pwa.backgroundColor)
43
+ ? pwa.backgroundColor
44
+ : DEFAULT_PWA_BACKGROUND_COLOR;
45
+ return {
46
+ name,
47
+ short_name: name.length <= MAX_SHORT_NAME_LENGTH
48
+ ? name
49
+ : name.slice(0, MAX_SHORT_NAME_LENGTH).trim(),
50
+ start_url: '/',
51
+ scope: '/',
52
+ display: 'standalone',
53
+ background_color: background,
54
+ theme_color: background,
55
+ icons: [
56
+ {
57
+ src: icons.icon192Url,
58
+ sizes: '192x192',
59
+ type: 'image/png',
60
+ purpose: 'any',
61
+ },
62
+ {
63
+ src: icons.icon512Url,
64
+ sizes: '512x512',
65
+ type: 'image/png',
66
+ purpose: 'any',
67
+ },
68
+ ],
69
+ };
70
+ };
71
+ /** What an app's zite.config.json sets of its pages' heads; nothing it leaves out. */
72
+ export const siteHeadOf = (config) => {
73
+ const parsed = settings.safeParse(config);
74
+ const { seoSettings: seo, pwaSettings: pwa } = parsed.success
75
+ ? parsed.data
76
+ : {};
77
+ const manifest = webManifestOf(pwa, seo?.title);
78
+ return {
79
+ ...(seo?.title && { title: seo.title }),
80
+ ...(seo?.description && { description: seo.description }),
81
+ ...(seo?.thumbnailUrl && { image: seo.thumbnailUrl }),
82
+ ...(seo?.faviconUrl && { icon: seo.faviconUrl }),
83
+ ...(manifest && {
84
+ manifest,
85
+ appleTouchIcon: pwa?.icons?.appleTouchIconUrl,
86
+ }),
87
+ };
88
+ };
@@ -0,0 +1,50 @@
1
+ import { type PluginOption } from 'vite';
2
+ import type { ZiteSchema } from '../../sync/lib.js';
3
+ import { type SchemaNames } from '../../sync/sdkNames.js';
4
+ import { type BuiltAirtableSettings } from '../platform/airtable/settings.js';
5
+ import type { DataNameMappings } from '../platform/data/types.js';
6
+ /** @internal A value as the string literal the build splices in for it. */
7
+ export declare const splicedLiteral: (value: unknown) => string;
8
+ /** @internal */
9
+ export declare const REFUSED_IMPORTS: RegExp[];
10
+ /** @internal What TanStack's import protection hands `onViolation`. */
11
+ export type ImportViolation = {
12
+ envType: 'client' | 'server';
13
+ type: 'specifier' | 'file' | 'marker';
14
+ specifier: string;
15
+ importer: string;
16
+ importerLoc?: {
17
+ file?: string;
18
+ line: number;
19
+ column: number;
20
+ };
21
+ snippet?: {
22
+ lines: string[];
23
+ };
24
+ };
25
+ /**
26
+ * @internal Zite's own message for a refused import, naming the fix; undefined leaves TanStack's, whose suggestions
27
+ * would send an agent to a raw createServerFn or a `.client.ts` file.
28
+ */
29
+ export declare const refusedImportMessage: (violation: ImportViolation, root: string) => string | undefined;
30
+ /** @internal The workspace's zite.schema.json as a server build carries it; null without one, a throw for one it can't read. */
31
+ export declare const workspaceSchemaNamesOf: (appDir: string) => SchemaNames | null;
32
+ /** @internal The app's Airtable integrations, from its own and its workspace's zite.config.json and zite.lock. */
33
+ export declare const builtAirtableSettingsOf: (appDir: string) => Record<string, BuiltAirtableSettings>;
34
+ /** @internal A workspace's zite.schema.json as the platform's `nameMappings`: the SDK names `.zite/db.ts` was generated with. */
35
+ export declare const workspaceNameMappingsOf: (raw: ZiteSchema) => DataNameMappings;
36
+ /**
37
+ * @internal The sign-in settings `zitejs dev` wrote for the app, for the module `local` mounts; null without them, or
38
+ * when the app's env sets `ZITE_DEV_USER`, whose stand-in wins.
39
+ */
40
+ export declare const devSignInOf: (appDir: string, appEnv: Record<string, string | undefined>) => Record<string, string> | null;
41
+ /** @internal The app's id in its zite.config.json, which `local` mints dev tokens for; null without one. */
42
+ export declare const devAppIdOf: (appDir: string) => string | null;
43
+ export type ZiteOptions = {
44
+ /** A server entry the caller owns, relative to the app root. By default zite() writes the platform's. */
45
+ serverEntry?: string;
46
+ /** Build for Cloudflare Workers, the target the platform deploys. Defaults to true; false builds for Node. */
47
+ cloudflare?: boolean;
48
+ };
49
+ /** The one plugin a Zite app's `vite.config.ts` uses. */
50
+ export declare function zite(options?: ZiteOptions): PluginOption[];
@@ -0,0 +1,487 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { loadEnv } from 'vite';
4
+ import { parse as parseEnv } from 'dotenv';
5
+ import { tanstackStart } from '@tanstack/react-start/plugin/vite';
6
+ import viteReact from '@vitejs/plugin-react';
7
+ import { ziteId } from '../../vite/index.js';
8
+ import { schemaNamesOf } from '../../sync/sdkNames.js';
9
+ import { nameMappingsOf } from '../platform/data/names.js';
10
+ import { airtableSettingsFrom, configFileOf, lockFileOf, } from '../platform/airtable/settings.js';
11
+ import { factoryDescriptions } from '../describe/descriptions.js';
12
+ import { sourceRootOf } from '../../sourceRoots.js';
13
+ import { registrationHashes } from './registrationHash.js';
14
+ import { sdkPatches } from './sdkPatches.js';
15
+ import { siteHeadOf } from './siteHead.js';
16
+ import { hasAppStart, renderStartInstance, renderStartServerEntry, renderWorkflowModules, START_INSTANCE_ENTRY, START_SERVER_ENTRY, workflowFiles, writeIfChanged, } from './entries.js';
17
+ // Must match the literals in ../serve/server.ts and ../describe/describe.ts, which the build rewrites.
18
+ const FN_IDS_TOKEN = '__ZITE_FN_IDS__';
19
+ const FN_DESCRIPTIONS_LITERAL = /(["'`])__ZITE_FN_DESCRIPTIONS__\1/;
20
+ const ROUTE_FILES_LITERAL = /(["'`])__ZITE_ROUTE_FILES__\1/;
21
+ const REGISTRATION_HASHES_LITERAL = /(["'`])__ZITE_REGISTRATION_HASHES__\1/;
22
+ const APP_FACTS_LITERAL = /(["'`])__ZITE_APP_FACTS__\1/;
23
+ // Spliced in after Rolldown's `charset: 'ascii'` has run, so it escapes what it splices the same way.
24
+ const asciiOnly = (code) => code.replace(/[\u0080-\uffff]/g, char => `\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}`);
25
+ /** @internal A value as the string literal the build splices in for it. */
26
+ export const splicedLiteral = (value) => asciiOnly(JSON.stringify(JSON.stringify(value)));
27
+ // TanStack's generator writes each route file's id into its createFileRoute call and keeps it in step.
28
+ const FILE_ROUTE_ID = /\bcreateFileRoute\(\s*(["'`])([^"'`]+)\1\s*\)/;
29
+ // zitejs's empty registry, which the build replaces with the app's.
30
+ const WORKFLOW_REGISTRY = /[\\/]zitejs[\\/]dist[\\/]esm[\\/]start[\\/]build[\\/]placeholders[\\/]workflowModules\.js$/;
31
+ // zitejs's null auth-hooks module, which the build points at the app's `zite.auth.ts`.
32
+ const AUTH_HOOKS_REGISTRY = /[\\/]zitejs[\\/]dist[\\/]esm[\\/]start[\\/]build[\\/]placeholders[\\/]authHooksModule\.js$/;
33
+ const AUTH_HOOKS_FILE = 'zite.auth.ts';
34
+ // zitejs's null workspace names, which a server build and `vite dev` fill from the workspace root, where `zitejs/db`
35
+ // comes from too.
36
+ const WORKSPACE_SCHEMA_MODULE = /[\\/]zitejs[\\/]dist[\\/]esm[\\/]start[\\/]build[\\/]placeholders[\\/]workspaceSchema\.js$/;
37
+ const WORKSPACE_SCHEMA_FILE = '../../zite.schema.json';
38
+ // zitejs's null Airtable settings, which a server build and `vite dev` fill from the app's and the workspace's config.
39
+ const AIRTABLE_SETTINGS_MODULE = /[\\/]zitejs[\\/]dist[\\/]esm[\\/]start[\\/]platform[\\/]airtable[\\/]built\.js$/;
40
+ const APP_LOCK_FILE = 'zite.lock';
41
+ const WORKSPACE_CONFIG_FILE = '../../zite.config.json';
42
+ const WORKSPACE_LOCK_FILE = '../../zite.lock';
43
+ // zitejs's null Settings, which a server build and `vite dev` fill from the app's zite.config.json.
44
+ const SITE_HEAD_MODULE = /[\\/]zitejs[\\/]dist[\\/]esm[\\/]start[\\/]build[\\/]placeholders[\\/]siteHead\.js$/;
45
+ // zitejs's null app id, which `vite dev` fills from the app's zite.config.json.
46
+ const DEV_APP_MODULE = /[\\/]zitejs[\\/]dist[\\/]esm[\\/]start[\\/]build[\\/]placeholders[\\/]devApp\.js$/;
47
+ // zitejs's null sign-in settings, which `vite dev` fills from the `.zite/dev.env` that `zitejs dev` writes.
48
+ const DEV_SIGNIN_MODULE = /[\\/]zitejs[\\/]dist[\\/]esm[\\/]start[\\/]build[\\/]placeholders[\\/]devSignIn\.js$/;
49
+ const DEV_ENV_FILE = '.zite/dev.env';
50
+ const DEV_SIGNIN_KEYS = ['ZITE_SIGNIN', 'ZITE_AUTH_SECRET'];
51
+ const APP_CONFIG_FILE = 'zite.config.json';
52
+ // What no module in a Start app's `src/` may import, in the browser or on the server, and what to write instead.
53
+ const REFUSED = [
54
+ {
55
+ pattern: /^zitejs\/(api|caller)(\/|$)/,
56
+ fix: "it's classic's: a Start app calls its own server functions directly, from a loader or an event handler",
57
+ },
58
+ {
59
+ pattern: /^zitejs\/backend(\/|$)/,
60
+ fix: "it's classic's server module: import ZiteError and the rest from zitejs/start",
61
+ },
62
+ {
63
+ pattern: /^react-router(-dom)?(\/|$)/,
64
+ fix: 'use @tanstack/react-router instead: file routes in src/routes, and its Link and useNavigate',
65
+ },
66
+ {
67
+ pattern: /^cloudflare:workers$/,
68
+ fix: 'read process.env inside a handler instead',
69
+ },
70
+ {
71
+ pattern: /^zitejs\/signin(\/|$)/,
72
+ fix: "it's the platform's sign-in, which runs for the app: use loginWithRedirect or logout from zitejs/auth, or loginHref from zitejs/start",
73
+ },
74
+ ];
75
+ /** @internal */
76
+ export const REFUSED_IMPORTS = REFUSED.map(({ pattern }) => pattern);
77
+ const SERVER_CODE_FIX = "that's server code, which the browser can't load: call a signedInFn or publicFn from the page's loader instead";
78
+ /**
79
+ * @internal Zite's own message for a refused import, naming the fix; undefined leaves TanStack's, whose suggestions
80
+ * would send an agent to a raw createServerFn or a `.client.ts` file.
81
+ */
82
+ export const refusedImportMessage = (violation, root) => {
83
+ const fix = (violation.type === 'specifier'
84
+ ? REFUSED.find(({ pattern }) => pattern.test(violation.specifier))?.fix
85
+ : undefined) ??
86
+ (violation.envType === 'client' ? SERVER_CODE_FIX : undefined);
87
+ if (!fix)
88
+ return undefined;
89
+ const rel = (file) => path.isAbsolute(file)
90
+ ? path.relative(root, file).split(path.sep).join('/')
91
+ : file;
92
+ const loc = violation.importerLoc;
93
+ const file = rel(loc?.file ?? violation.importer);
94
+ const where = loc ? `${file}:${loc.line}:${loc.column}` : file;
95
+ return [
96
+ `[zite] ${where} imports "${rel(violation.specifier)}": ${fix}.`,
97
+ ...(violation.snippet ? ['', ...violation.snippet.lines] : []),
98
+ ].join('\n');
99
+ };
100
+ /** @internal The workspace's zite.schema.json as a server build carries it; null without one, a throw for one it can't read. */
101
+ export const workspaceSchemaNamesOf = (appDir) => {
102
+ const file = path.join(appDir, WORKSPACE_SCHEMA_FILE);
103
+ if (!existsSync(file))
104
+ return null;
105
+ try {
106
+ return schemaNamesOf(JSON.parse(readFileSync(file, 'utf-8')));
107
+ }
108
+ catch (error) {
109
+ throw new Error(`[zite] the workspace's zite.schema.json can't be read: ${error instanceof Error ? error.message : String(error)}`);
110
+ }
111
+ };
112
+ // As the platform reads them: a file that isn't there or isn't JSON is none, and one of another shape is narrowed here.
113
+ const readJson = (file, narrow) => {
114
+ let json;
115
+ try {
116
+ json = JSON.parse(readFileSync(file, 'utf-8'));
117
+ }
118
+ catch {
119
+ return undefined;
120
+ }
121
+ return narrow(json);
122
+ };
123
+ /** @internal The app's Airtable integrations, from its own and its workspace's zite.config.json and zite.lock. */
124
+ export const builtAirtableSettingsOf = (appDir) => airtableSettingsFrom({
125
+ appConfig: readJson(path.join(appDir, APP_CONFIG_FILE), configFileOf),
126
+ appLock: readJson(path.join(appDir, APP_LOCK_FILE), lockFileOf),
127
+ workspaceConfig: readJson(path.join(appDir, WORKSPACE_CONFIG_FILE), configFileOf),
128
+ workspaceLock: readJson(path.join(appDir, WORKSPACE_LOCK_FILE), lockFileOf),
129
+ hasSchema: existsSync(path.join(appDir, WORKSPACE_SCHEMA_FILE)),
130
+ });
131
+ /** @internal A workspace's zite.schema.json as the platform's `nameMappings`: the SDK names `.zite/db.ts` was generated with. */
132
+ export const workspaceNameMappingsOf = (raw) => nameMappingsOf(schemaNamesOf(raw));
133
+ /**
134
+ * @internal The sign-in settings `zitejs dev` wrote for the app, for the module `local` mounts; null without them, or
135
+ * when the app's env sets `ZITE_DEV_USER`, whose stand-in wins.
136
+ */
137
+ export const devSignInOf = (appDir, appEnv) => {
138
+ if (appEnv.ZITE_DEV_USER)
139
+ return null;
140
+ let written;
141
+ try {
142
+ written = parseEnv(readFileSync(path.join(appDir, DEV_ENV_FILE), 'utf-8'));
143
+ }
144
+ catch {
145
+ return null;
146
+ }
147
+ const kept = Object.fromEntries(DEV_SIGNIN_KEYS.flatMap(key => (written[key] ? [[key, written[key]]] : [])));
148
+ return kept.ZITE_SIGNIN ? kept : null;
149
+ };
150
+ /** @internal The app's id in its zite.config.json, which `local` mints dev tokens for; null without one. */
151
+ export const devAppIdOf = (appDir) => {
152
+ try {
153
+ const { id } = JSON.parse(readFileSync(path.join(appDir, APP_CONFIG_FILE), 'utf-8'));
154
+ return typeof id === 'string' && id ? id : null;
155
+ }
156
+ catch {
157
+ return null;
158
+ }
159
+ };
160
+ // Platform-pinned Worker settings. The deploy uses its own fixed template, so
161
+ // these only have to match it; apps don't carry a wrangler config.
162
+ const WORKER_COMPATIBILITY_DATE = '2026-09-25';
163
+ const WORKER_COMPATIBILITY_FLAGS = ['nodejs_compat'];
164
+ // Resolved from the app at build time; zitejs doesn't depend on it.
165
+ const loadCloudflare = async (main) => {
166
+ const { cloudflare } = (await import('@cloudflare/vite-plugin'));
167
+ return cloudflare({
168
+ viteEnvironment: { name: 'ssr' },
169
+ config: {
170
+ name: 'zite-app',
171
+ main,
172
+ compatibility_date: WORKER_COMPATIBILITY_DATE,
173
+ compatibility_flags: WORKER_COMPATIBILITY_FLAGS,
174
+ },
175
+ });
176
+ };
177
+ /** The one plugin a Zite app's `vite.config.ts` uses. */
178
+ export function zite(options = {}) {
179
+ const serverEntry = options.serverEntry ?? START_SERVER_ENTRY;
180
+ // Platform-owned, so they're rewritten whenever they differ. Sandboxes run the
181
+ // image's zitejs for `generate`, which may predate Start; the plugin can't.
182
+ const appDir = process.cwd();
183
+ if (!options.serverEntry) {
184
+ writeIfChanged(appDir, START_SERVER_ENTRY, renderStartServerEntry(options.cloudflare === false ? 'node' : 'cloudflare'));
185
+ }
186
+ writeIfChanged(appDir, START_INSTANCE_ENTRY, renderStartInstance(hasAppStart(appDir)));
187
+ // Every server function TanStack's compiler found, from its own hook, by id.
188
+ const ids = new Map();
189
+ const compileZitejs = {
190
+ name: 'zite:compile-zitejs',
191
+ // The factories must go through TanStack's compiler in both environments.
192
+ // The peer dependency gets zitejs crawled already; this keeps it true if an
193
+ // install drops that. A Node build bundles everything, so externalized
194
+ // libraries can't load the root's React 18 renderer.
195
+ config: (config, { command, mode }) => {
196
+ const root = path.resolve(config.root ?? '.');
197
+ // The `local` provider reads process.env. In workerd, Cloudflare's plugin sets it from the app's .env; on Node, this does.
198
+ if (command === 'serve' && options.cloudflare === false) {
199
+ Object.assign(process.env, loadEnv(mode, root, [
200
+ 'ZITE_DEV_',
201
+ 'ZITE_URLS',
202
+ 'ZITE_SIGNIN',
203
+ 'ZITE_AUTH_SECRET',
204
+ ]));
205
+ }
206
+ const src = `${path.join(root, 'src')}/`;
207
+ return {
208
+ ssr: { noExternal: options.cloudflare === false ? true : ['zitejs'] },
209
+ optimizeDeps: { exclude: ['zitejs'] },
210
+ resolve: {
211
+ // `@/` as in classic apps and shadcn, `~/` as in TanStack's templates.
212
+ alias: [
213
+ { find: /^@\//, replacement: src },
214
+ { find: /^~\//, replacement: src },
215
+ // The workspace SDKs `zitejs generate` writes, as classic apps map them.
216
+ {
217
+ find: /^zitejs\/db$/,
218
+ replacement: path.join(root, '../../.zite/db.ts'),
219
+ },
220
+ {
221
+ find: /^zitejs\/integrations$/,
222
+ replacement: path.join(root, '.zite/integrations/index.ts'),
223
+ },
224
+ {
225
+ find: /^zitejs\/email$/,
226
+ replacement: path.join(root, '.zite/integrations/email.ts'),
227
+ },
228
+ {
229
+ find: /^zitejs\/meta$/,
230
+ replacement: path.join(root, '.zite/meta.ts'),
231
+ },
232
+ // Classic's actions run on better-auth's client; Start's call the sign-in module's routes.
233
+ { find: /^zitejs\/auth$/, replacement: 'zitejs/start/auth' },
234
+ ],
235
+ // Shared workspace libraries resolve from the root, where classic apps
236
+ // keep React 18; recharts 2 needs the app's react-is 19 or drops series.
237
+ dedupe: ['react-is'],
238
+ },
239
+ };
240
+ },
241
+ // Each new isolate loads the whole server bundle, so its size is cold-start
242
+ // time; Vite leaves SSR output unminified. Under `vite dev`, Cloudflare's
243
+ // plugin would pre-bundle zitejs's server entry, past the modules below
244
+ // that fill zitejs's registries and workspace names.
245
+ configEnvironment: (name, config, { command }) => name !== 'ssr'
246
+ ? undefined
247
+ : {
248
+ ...(options.cloudflare !== false && {
249
+ build: {
250
+ ...(config.build?.minify === undefined && { minify: true }),
251
+ // V8 keeps a module with any character past Latin-1 as two bytes a character, and every byte of
252
+ // script is isolate heap. Escaped, the measured server bundles took 13-17% less.
253
+ rolldownOptions: { output: { charset: 'ascii' } },
254
+ },
255
+ }),
256
+ ...(command === 'serve' && {
257
+ optimizeDeps: { exclude: ['zitejs'] },
258
+ }),
259
+ },
260
+ };
261
+ // Each server function's `description` option, by name, and each route's file, by route id: for the editor.
262
+ const descriptions = new Map();
263
+ const routeFiles = new Map();
264
+ const srcDir = `${path.join(appDir, 'src')}${path.sep}`;
265
+ const functionIds = {
266
+ name: 'zite:function-ids',
267
+ apply: 'build',
268
+ transform(code, id) {
269
+ if (this.environment?.config.consumer !== 'server' ||
270
+ !id.startsWith(srcDir))
271
+ return;
272
+ const file = id.split('?')[0];
273
+ const routeId = FILE_ROUTE_ID.exec(code)?.[2];
274
+ if (routeId && !id.includes('?'))
275
+ routeFiles.set(routeId, path.relative(appDir, file).split(path.sep).join('/'));
276
+ if (code.includes('description')) {
277
+ try {
278
+ for (const [name, text] of factoryDescriptions(this.parse(code)))
279
+ descriptions.set(name, text);
280
+ }
281
+ catch {
282
+ // An unreadable module shows no descriptions.
283
+ }
284
+ }
285
+ },
286
+ generateBundle(_, bundle) {
287
+ const described = Object.fromEntries([...descriptions].filter(([name]) => ids.has(name)));
288
+ // Every module the workflow registry imports, hashed over its graph: describe gives each provider trigger its module's.
289
+ const server = this.environment?.config.consumer === 'server';
290
+ const registry = server
291
+ ? [...this.getModuleIds()].find(id => WORKFLOW_REGISTRY.test(id.split('?')[0]))
292
+ : undefined;
293
+ const registered = registry
294
+ ? (this.getModuleInfo(registry)?.dynamicallyImportedIds ?? [])
295
+ : [];
296
+ const hashes = registrationHashes(appDir, registered, id => this.getModuleInfo(id));
297
+ const facts = {
298
+ internal: readJson(path.join(appDir, APP_CONFIG_FILE), json => json?.accessMode) === 'internal',
299
+ automation: sourceRootOf(appDir) === 'automations',
300
+ };
301
+ for (const chunk of Object.values(bundle)) {
302
+ if (chunk.type !== 'chunk')
303
+ continue;
304
+ if (chunk.code.includes(FN_IDS_TOKEN))
305
+ chunk.code = chunk.code.replace(FN_IDS_TOKEN, () => asciiOnly([...ids.keys()].join(',')));
306
+ chunk.code = chunk.code
307
+ .replace(FN_DESCRIPTIONS_LITERAL, () => splicedLiteral(described))
308
+ .replace(ROUTE_FILES_LITERAL, () => splicedLiteral(Object.fromEntries(routeFiles)))
309
+ .replace(REGISTRATION_HASHES_LITERAL, () => splicedLiteral(hashes))
310
+ .replace(APP_FACTS_LITERAL, () => splicedLiteral(facts));
311
+ }
312
+ },
313
+ };
314
+ const workflowRegistry = {
315
+ name: 'zite:workflow-registry',
316
+ load: id => WORKFLOW_REGISTRY.test(id.split('?')[0])
317
+ ? renderWorkflowModules(appDir, workflowFiles(appDir))
318
+ : undefined,
319
+ };
320
+ const authHooksRegistry = {
321
+ name: 'zite:auth-hooks',
322
+ load: id => {
323
+ if (!AUTH_HOOKS_REGISTRY.test(id.split('?')[0]))
324
+ return undefined;
325
+ const file = path.join(appDir, AUTH_HOOKS_FILE);
326
+ return existsSync(file)
327
+ ? `export const authHooksModule = () => import(${JSON.stringify(file)});\n`
328
+ : 'export const authHooksModule = null;\n';
329
+ },
330
+ };
331
+ // The names the build's `zitejs/db` was generated with, from the same commit's schema. Only the server's: a browser
332
+ // never translates a data call, and its bundle carries no table or field id.
333
+ let serving = false;
334
+ const workspaceSchema = {
335
+ name: 'zite:workspace-schema',
336
+ configResolved(config) {
337
+ serving = config.command === 'serve';
338
+ },
339
+ load(id) {
340
+ if (!WORKSPACE_SCHEMA_MODULE.test(id.split('?')[0]))
341
+ return undefined;
342
+ this.addWatchFile(path.join(appDir, WORKSPACE_SCHEMA_FILE));
343
+ let names = null;
344
+ try {
345
+ if (this.environment?.config.consumer === 'server')
346
+ names = workspaceSchemaNamesOf(appDir);
347
+ }
348
+ catch (error) {
349
+ // A build fails rather than ship names its client wasn't written against; `vite dev` carries on mid-edit.
350
+ if (!serving)
351
+ throw error;
352
+ }
353
+ return `export const workspaceSchemaNames = ${JSON.stringify(names)};\n`;
354
+ },
355
+ };
356
+ // The integrations the app runs itself, from the same commit's config, and only on the server, which calls them.
357
+ const airtableSettings = {
358
+ name: 'zite:airtable-settings',
359
+ load(id) {
360
+ if (!AIRTABLE_SETTINGS_MODULE.test(id.split('?')[0]))
361
+ return undefined;
362
+ for (const file of [
363
+ APP_CONFIG_FILE,
364
+ APP_LOCK_FILE,
365
+ WORKSPACE_CONFIG_FILE,
366
+ WORKSPACE_LOCK_FILE,
367
+ ])
368
+ this.addWatchFile(path.join(appDir, file));
369
+ const settings = this.environment?.config.consumer === 'server'
370
+ ? builtAirtableSettingsOf(appDir)
371
+ : null;
372
+ return `export const builtAirtableSettings = ${JSON.stringify(settings)};\n`;
373
+ },
374
+ };
375
+ // The app's Settings for its pages off Zite, where no host sends them. Only the server renders a page's head.
376
+ const siteHead = {
377
+ name: 'zite:site-head',
378
+ load(id) {
379
+ if (!SITE_HEAD_MODULE.test(id.split('?')[0]))
380
+ return undefined;
381
+ this.addWatchFile(path.join(appDir, APP_CONFIG_FILE));
382
+ const head = this.environment?.config.consumer === 'server'
383
+ ? (readJson(path.join(appDir, APP_CONFIG_FILE), siteHeadOf) ?? null)
384
+ : null;
385
+ return `export const builtSiteHead = ${JSON.stringify(head)};\n`;
386
+ },
387
+ };
388
+ // Under `vite dev` only: a published build is never `local`'s to mint for.
389
+ const devApp = {
390
+ name: 'zite:dev-app',
391
+ apply: 'serve',
392
+ load(id) {
393
+ if (!DEV_APP_MODULE.test(id.split('?')[0]))
394
+ return undefined;
395
+ this.addWatchFile(path.join(appDir, APP_CONFIG_FILE));
396
+ return `export const devAppId = ${JSON.stringify(devAppIdOf(appDir))};\n`;
397
+ },
398
+ };
399
+ // Under `vite dev` only, and only to the server: the secret seals the session cookie, and never reaches a browser.
400
+ let devEnv = {};
401
+ const devSignIn = {
402
+ name: 'zite:dev-signin',
403
+ apply: 'serve',
404
+ configResolved(config) {
405
+ const envDir = typeof config.envDir === 'string' ? config.envDir : config.root;
406
+ devEnv = {
407
+ ...loadEnv(config.mode, envDir, ['ZITE_DEV_USER']),
408
+ ...process.env,
409
+ };
410
+ },
411
+ load(id) {
412
+ if (!DEV_SIGNIN_MODULE.test(id.split('?')[0]))
413
+ return undefined;
414
+ this.addWatchFile(path.join(appDir, DEV_ENV_FILE));
415
+ const settings = this.environment?.config.consumer === 'server'
416
+ ? devSignInOf(appDir, devEnv)
417
+ : null;
418
+ return `export const devSignIn = ${JSON.stringify(settings)};\n`;
419
+ },
420
+ };
421
+ return [
422
+ // First, so ids name lines in the source, before TanStack splits a route's component out of it.
423
+ ziteId(),
424
+ tanstackStart({
425
+ // TanStack resolves these from `src/`.
426
+ server: { entry: `../${serverEntry.replace(/\.ts$/, '')}` },
427
+ start: { entry: `../${START_INSTANCE_ENTRY.replace(/\.ts$/, '')}` },
428
+ serverFns: {
429
+ generateFunctionId: ({ filename, functionName }) => {
430
+ const id = functionName.replace(/_createServerFn_handler$/, '');
431
+ if (/(^|\/)node_modules\//.test(filename)) {
432
+ throw new Error(`[zite] ${filename} defines server function ${id}; dependencies can't ship server functions`);
433
+ }
434
+ const existing = ids.get(id);
435
+ if (existing && existing !== filename) {
436
+ throw new Error(`[zite] server function name ${id} is used in both ${existing} and ${filename}`);
437
+ }
438
+ ids.set(id, filename);
439
+ return id;
440
+ },
441
+ },
442
+ importProtection: {
443
+ behavior: 'error',
444
+ // Thrown, it replaces TanStack's text; TanStack's schema types the violation unknown.
445
+ onViolation: violation => {
446
+ const message = refusedImportMessage(violation, appDir);
447
+ if (message)
448
+ throw new Error(message);
449
+ },
450
+ client: {
451
+ // Appended to TanStack's own.
452
+ specifiers: [
453
+ ...REFUSED_IMPORTS,
454
+ 'zitejs/start/fetch',
455
+ 'zitejs/start/server',
456
+ 'zitejs/start/worker',
457
+ 'zitejs/start/describe',
458
+ 'zitejs/runtime',
459
+ ],
460
+ // Replaces TanStack's list, so its `**/*.server.*` is restated. File
461
+ // patterns also catch `zitejs/db`, `zitejs/integrations` and `zitejs/meta`,
462
+ // which the aliases above rewrite before specifiers are matched.
463
+ files: [
464
+ '**/*.server.*',
465
+ '**/.zite/db.ts',
466
+ '**/.zite/integrations/**',
467
+ '**/.zite/meta.ts',
468
+ ],
469
+ },
470
+ // Replaces TanStack's empty list; its `**/*.client.*` files stay.
471
+ server: { specifiers: REFUSED_IMPORTS },
472
+ },
473
+ }),
474
+ options.cloudflare !== false ? loadCloudflare(serverEntry) : null,
475
+ options.cloudflare !== false ? sdkPatches() : null,
476
+ viteReact(),
477
+ compileZitejs,
478
+ functionIds,
479
+ workflowRegistry,
480
+ authHooksRegistry,
481
+ workspaceSchema,
482
+ airtableSettings,
483
+ siteHead,
484
+ devApp,
485
+ devSignIn,
486
+ ];
487
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ // zitejs/backend, zitejs/backend/base and zitejs/caller as a Start app's types see them, under the `zite-start`
2
+ // condition: classic's server modules, with nothing in them for a Start app. ZiteError and the rest come from
3
+ // zitejs/start, and server functions are called directly.
4
+ export {};