houdini 2.0.0-next.12 → 2.0.0-next.22

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 (432) hide show
  1. package/build/adapter/index.d.ts +2 -2
  2. package/build/adapter/index.js +6 -0
  3. package/build/cmd/generate.d.ts +5 -0
  4. package/build/cmd/generate.js +77 -0
  5. package/build/cmd/index.js +32 -0
  6. package/build/cmd/init.js +530 -0
  7. package/build/cmd/pullSchema.js +21 -0
  8. package/build/{vite → lib}/ast.d.ts +1 -1
  9. package/build/lib/ast.js +71 -0
  10. package/build/lib/codegen.d.ts +55 -0
  11. package/build/lib/codegen.js +522 -0
  12. package/build/lib/config.d.ts +219 -177
  13. package/build/lib/config.js +134 -0
  14. package/build/lib/constants.js +10 -0
  15. package/build/lib/database.d.ts +6 -0
  16. package/build/lib/database.js +629 -0
  17. package/build/lib/deepMerge.js +23 -0
  18. package/build/lib/error.d.ts +16 -0
  19. package/build/lib/error.js +115 -0
  20. package/build/lib/fs.d.ts +7 -9
  21. package/build/lib/fs.js +245 -0
  22. package/build/lib/graphql.d.ts +5 -32
  23. package/build/lib/graphql.js +36 -0
  24. package/build/lib/imports.d.ts +29 -14
  25. package/build/lib/imports.js +66 -0
  26. package/build/lib/index.d.ts +16 -24
  27. package/build/lib/index.js +20 -0
  28. package/build/lib/logger.d.ts +12 -0
  29. package/build/lib/logger.js +45 -0
  30. package/build/lib/parse.d.ts +1 -2
  31. package/build/lib/parse.js +30 -0
  32. package/build/lib/path.d.ts +0 -1
  33. package/build/lib/path.js +44 -0
  34. package/build/lib/pipeline.d.ts +1 -1
  35. package/build/lib/pipeline.js +8 -0
  36. package/build/lib/plugins.d.ts +4 -0
  37. package/build/lib/plugins.js +72 -0
  38. package/build/lib/project.d.ts +17 -0
  39. package/build/lib/project.js +183 -0
  40. package/build/lib/schema.d.ts +1 -0
  41. package/build/lib/schema.js +62 -0
  42. package/build/lib/sleep.d.ts +1 -0
  43. package/build/lib/sleep.js +8 -0
  44. package/build/lib/types.d.ts +93 -304
  45. package/build/lib/types.js +37 -0
  46. package/build/lib/walk.d.ts +4 -3
  47. package/build/lib/walk.js +138 -0
  48. package/build/node/index.d.ts +37 -0
  49. package/build/node/index.js +271 -0
  50. package/build/package.json +201 -0
  51. package/build/{lib/router → router}/conventions.d.ts +14 -5
  52. package/build/router/conventions.js +165 -0
  53. package/build/{runtime-esm/router → router}/cookies.js +21 -21
  54. package/build/{runtime-esm/router → router}/jwt.js +34 -17
  55. package/build/{lib/router → router}/manifest.d.ts +2 -2
  56. package/build/router/manifest.js +279 -0
  57. package/build/{runtime-cjs/router → router}/match.d.ts +6 -6
  58. package/build/{runtime-esm/router → router}/match.js +50 -12
  59. package/build/{runtime/router → router}/server.d.ts +21 -3
  60. package/build/{runtime-esm/router → router}/server.js +43 -5
  61. package/build/{runtime-esm/router → router}/session.js +1 -1
  62. package/build/{runtime-cjs/router → router}/types.d.ts +1 -1
  63. package/build/runtime/cache/gc.d.ts +1 -1
  64. package/build/{runtime-esm → runtime}/cache/gc.js +0 -1
  65. package/build/runtime/cache/index.d.ts +169 -3
  66. package/build/{runtime-esm/cache/cache.js → runtime/cache/index.js} +34 -49
  67. package/build/runtime/cache/lists.d.ts +9 -9
  68. package/build/{runtime-esm → runtime}/cache/lists.js +29 -27
  69. package/build/runtime/cache/staleManager.d.ts +1 -1
  70. package/build/{runtime-esm → runtime}/cache/staleManager.js +2 -27
  71. package/build/runtime/cache/storage.d.ts +1 -1
  72. package/build/{runtime-esm → runtime}/cache/storage.js +6 -8
  73. package/build/runtime/cache/subscription.d.ts +11 -5
  74. package/build/{runtime-esm → runtime}/cache/subscription.js +10 -11
  75. package/build/runtime/{client/index.d.ts → client.d.ts} +15 -22
  76. package/build/runtime/client.js +86 -0
  77. package/build/runtime/config.d.ts +7 -0
  78. package/build/{runtime-esm/lib → runtime}/config.js +6 -19
  79. package/build/runtime/{lib/constants.d.ts → constants.d.ts} +1 -1
  80. package/build/{runtime-esm/lib → runtime}/deepEquals.js +4 -2
  81. package/build/runtime/{client/documentStore.d.ts → documentStore.d.ts} +13 -9
  82. package/build/{runtime-esm/client → runtime}/documentStore.js +33 -70
  83. package/build/{runtime-cjs/lib → runtime}/flatten.d.ts +1 -1
  84. package/build/runtime/index.d.ts +12 -8
  85. package/build/runtime/index.js +30 -0
  86. package/build/{runtime-cjs/lib → runtime}/key.d.ts +1 -1
  87. package/build/{runtime-esm/lib → runtime}/key.js +4 -4
  88. package/build/{runtime-esm/lib → runtime}/log.js +3 -3
  89. package/build/{runtime-cjs/lib → runtime}/pageInfo.d.ts +3 -3
  90. package/build/{runtime-esm/lib → runtime}/pageInfo.js +2 -2
  91. package/build/{runtime-cjs/lib → runtime}/pagination.d.ts +8 -8
  92. package/build/{runtime-esm/lib → runtime}/pagination.js +19 -19
  93. package/build/{runtime-cjs/lib → runtime}/scalars.d.ts +6 -6
  94. package/build/{runtime-esm/lib → runtime}/scalars.js +10 -43
  95. package/build/{runtime-cjs/lib → runtime}/selection.d.ts +1 -1
  96. package/build/{runtime-esm/lib → runtime}/selection.js +2 -2
  97. package/build/runtime/{lib/store.d.ts → store.d.ts} +1 -1
  98. package/build/{runtime-esm/lib → runtime}/store.js +2 -3
  99. package/build/{runtime-cjs/lib → runtime}/types.d.ts +39 -84
  100. package/build/{runtime-esm/lib → runtime}/types.js +8 -22
  101. package/build/test/index.d.ts +6 -25
  102. package/build/test/index.js +329 -0
  103. package/build/vite/hmr.d.ts +23 -3
  104. package/build/vite/hmr.js +231 -0
  105. package/build/vite/houdini.d.ts +4 -10
  106. package/build/vite/houdini.js +127 -0
  107. package/build/vite/index.d.ts +13 -7
  108. package/build/vite/index.js +96 -0
  109. package/build/vite/package.json +1 -0
  110. package/build/vite/schema.d.ts +5 -3
  111. package/build/vite/schema.js +150 -0
  112. package/package.json +116 -37
  113. package/build/adapter-cjs/index.js +0 -33
  114. package/build/adapter-cjs/package.json +0 -1
  115. package/build/adapter-esm/index.js +0 -9
  116. package/build/cmd-cjs/index.js +0 -88787
  117. package/build/cmd-cjs/package.json +0 -1
  118. package/build/cmd-esm/index.js +0 -88791
  119. package/build/codegen/generators/artifacts/fieldKey.d.ts +0 -3
  120. package/build/codegen/generators/artifacts/index.d.ts +0 -17
  121. package/build/codegen/generators/artifacts/indexFile.d.ts +0 -2
  122. package/build/codegen/generators/artifacts/inputs.d.ts +0 -4
  123. package/build/codegen/generators/artifacts/operations.d.ts +0 -11
  124. package/build/codegen/generators/artifacts/selection.d.ts +0 -20
  125. package/build/codegen/generators/artifacts/utils.d.ts +0 -8
  126. package/build/codegen/generators/comments/jsdoc.d.ts +0 -2
  127. package/build/codegen/generators/definitions/enums.d.ts +0 -2
  128. package/build/codegen/generators/definitions/index.d.ts +0 -2
  129. package/build/codegen/generators/index.d.ts +0 -6
  130. package/build/codegen/generators/indexFile/index.d.ts +0 -2
  131. package/build/codegen/generators/persistedQueries/index.d.ts +0 -2
  132. package/build/codegen/generators/runtime/graphqlFunction.d.ts +0 -2
  133. package/build/codegen/generators/runtime/index.d.ts +0 -3
  134. package/build/codegen/generators/runtime/injectPlugins.d.ts +0 -7
  135. package/build/codegen/generators/runtime/pluginIndex.d.ts +0 -5
  136. package/build/codegen/generators/runtime/pluginRuntime.d.ts +0 -15
  137. package/build/codegen/generators/runtime/runtimeConfig.d.ts +0 -7
  138. package/build/codegen/generators/typescript/addReferencedInputTypes.d.ts +0 -4
  139. package/build/codegen/generators/typescript/documentTypes.d.ts +0 -2
  140. package/build/codegen/generators/typescript/imperativeTypeDef.d.ts +0 -2
  141. package/build/codegen/generators/typescript/index.d.ts +0 -2
  142. package/build/codegen/generators/typescript/inlineType.d.ts +0 -29
  143. package/build/codegen/generators/typescript/loadingState.d.ts +0 -8
  144. package/build/codegen/index.d.ts +0 -8
  145. package/build/codegen/transforms/addFields.d.ts +0 -2
  146. package/build/codegen/transforms/collectDefinitions.d.ts +0 -9
  147. package/build/codegen/transforms/componentFields.d.ts +0 -8
  148. package/build/codegen/transforms/fragmentVariables.d.ts +0 -17
  149. package/build/codegen/transforms/index.d.ts +0 -9
  150. package/build/codegen/transforms/list.d.ts +0 -9
  151. package/build/codegen/transforms/paginate.d.ts +0 -4
  152. package/build/codegen/transforms/runtimeScalars.d.ts +0 -2
  153. package/build/codegen/transforms/schema.d.ts +0 -2
  154. package/build/codegen/transforms/typename.d.ts +0 -2
  155. package/build/codegen/utils/commonjs.d.ts +0 -5
  156. package/build/codegen/utils/flattenSelections.d.ts +0 -11
  157. package/build/codegen/utils/index.d.ts +0 -4
  158. package/build/codegen/utils/moduleExport.d.ts +0 -4
  159. package/build/codegen/utils/murmur.d.ts +0 -9
  160. package/build/codegen/utils/objectIdentificationSelection.d.ts +0 -3
  161. package/build/codegen/utils/stripLoc.d.ts +0 -3
  162. package/build/codegen/validators/componentFields.d.ts +0 -2
  163. package/build/codegen/validators/index.d.ts +0 -5
  164. package/build/codegen/validators/noIDAlias.d.ts +0 -2
  165. package/build/codegen/validators/plugins.d.ts +0 -3
  166. package/build/codegen/validators/typeCheck.d.ts +0 -5
  167. package/build/codegen/validators/uniqueNames.d.ts +0 -2
  168. package/build/codegen-cjs/index.js +0 -74065
  169. package/build/codegen-cjs/package.json +0 -1
  170. package/build/codegen-esm/index.js +0 -74064
  171. package/build/lib/cleanupFiles.d.ts +0 -1
  172. package/build/lib/detectTools.d.ts +0 -16
  173. package/build/lib/introspection.d.ts +0 -3
  174. package/build/lib/plugin.d.ts +0 -2
  175. package/build/lib/router/index.d.ts +0 -9
  176. package/build/lib/router/server.d.ts +0 -7
  177. package/build/lib/router/types.d.ts +0 -23
  178. package/build/lib/typescript.d.ts +0 -20
  179. package/build/lib/watchAndRun.d.ts +0 -61
  180. package/build/lib-cjs/index.js +0 -78960
  181. package/build/lib-cjs/package.json +0 -1
  182. package/build/lib-esm/index.js +0 -78869
  183. package/build/runtime/cache/cache.d.ts +0 -169
  184. package/build/runtime/client/plugins/cache.d.ts +0 -9
  185. package/build/runtime/client/plugins/fetch.d.ts +0 -38
  186. package/build/runtime/client/plugins/fetchParams.d.ts +0 -9
  187. package/build/runtime/client/plugins/fragment.d.ts +0 -2
  188. package/build/runtime/client/plugins/index.d.ts +0 -9
  189. package/build/runtime/client/plugins/injectedPlugins.d.ts +0 -4
  190. package/build/runtime/client/plugins/mutation.d.ts +0 -2
  191. package/build/runtime/client/plugins/optimisticKeys.d.ts +0 -7
  192. package/build/runtime/client/plugins/query.d.ts +0 -2
  193. package/build/runtime/client/plugins/subscription.d.ts +0 -20
  194. package/build/runtime/client/plugins/test.d.ts +0 -15
  195. package/build/runtime/client/plugins/throwOnError.d.ts +0 -8
  196. package/build/runtime/client/utils/documentPlugins.d.ts +0 -3
  197. package/build/runtime/client/utils/index.d.ts +0 -1
  198. package/build/runtime/generated.d.ts +0 -5
  199. package/build/runtime/imports/config.d.ts +0 -3
  200. package/build/runtime/imports/pluginConfig.d.ts +0 -3
  201. package/build/runtime/lib/config.d.ts +0 -216
  202. package/build/runtime/lib/deepEquals.d.ts +0 -1
  203. package/build/runtime/lib/flatten.d.ts +0 -2
  204. package/build/runtime/lib/index.d.ts +0 -10
  205. package/build/runtime/lib/key.d.ts +0 -6
  206. package/build/runtime/lib/log.d.ts +0 -6
  207. package/build/runtime/lib/lru.d.ts +0 -52
  208. package/build/runtime/lib/pageInfo.d.ts +0 -7
  209. package/build/runtime/lib/pagination.d.ts +0 -27
  210. package/build/runtime/lib/scalars.d.ts +0 -14
  211. package/build/runtime/lib/selection.d.ts +0 -2
  212. package/build/runtime/lib/types.d.ts +0 -417
  213. package/build/runtime/public/cache.d.ts +0 -42
  214. package/build/runtime/public/index.d.ts +0 -1
  215. package/build/runtime/public/list.d.ts +0 -18
  216. package/build/runtime/public/record.d.ts +0 -40
  217. package/build/runtime/public/tests/test.d.ts +0 -156
  218. package/build/runtime/public/types.d.ts +0 -62
  219. package/build/runtime/router/cookies.d.ts +0 -41
  220. package/build/runtime/router/jwt.d.ts +0 -117
  221. package/build/runtime/router/match.d.ts +0 -39
  222. package/build/runtime/router/session.d.ts +0 -22
  223. package/build/runtime/router/types.d.ts +0 -26
  224. package/build/runtime/server/index.d.ts +0 -17
  225. package/build/runtime-cjs/cache/cache.d.ts +0 -169
  226. package/build/runtime-cjs/cache/cache.js +0 -1077
  227. package/build/runtime-cjs/cache/constants.d.ts +0 -1
  228. package/build/runtime-cjs/cache/constants.js +0 -28
  229. package/build/runtime-cjs/cache/gc.d.ts +0 -10
  230. package/build/runtime-cjs/cache/gc.js +0 -74
  231. package/build/runtime-cjs/cache/index.d.ts +0 -3
  232. package/build/runtime-cjs/cache/index.js +0 -25
  233. package/build/runtime-cjs/cache/lists.d.ts +0 -89
  234. package/build/runtime-cjs/cache/lists.js +0 -467
  235. package/build/runtime-cjs/cache/staleManager.d.ts +0 -31
  236. package/build/runtime-cjs/cache/staleManager.js +0 -123
  237. package/build/runtime-cjs/cache/storage.d.ts +0 -110
  238. package/build/runtime-cjs/cache/storage.js +0 -451
  239. package/build/runtime-cjs/cache/stuff.d.ts +0 -2
  240. package/build/runtime-cjs/cache/stuff.js +0 -56
  241. package/build/runtime-cjs/cache/subscription.d.ts +0 -52
  242. package/build/runtime-cjs/cache/subscription.js +0 -349
  243. package/build/runtime-cjs/client/documentStore.d.ts +0 -107
  244. package/build/runtime-cjs/client/documentStore.js +0 -487
  245. package/build/runtime-cjs/client/index.d.ts +0 -50
  246. package/build/runtime-cjs/client/index.js +0 -162
  247. package/build/runtime-cjs/client/plugins/cache.d.ts +0 -9
  248. package/build/runtime-cjs/client/plugins/cache.js +0 -138
  249. package/build/runtime-cjs/client/plugins/fetch.d.ts +0 -38
  250. package/build/runtime-cjs/client/plugins/fetch.js +0 -210
  251. package/build/runtime-cjs/client/plugins/fetchParams.d.ts +0 -9
  252. package/build/runtime-cjs/client/plugins/fetchParams.js +0 -47
  253. package/build/runtime-cjs/client/plugins/fragment.d.ts +0 -2
  254. package/build/runtime-cjs/client/plugins/fragment.js +0 -77
  255. package/build/runtime-cjs/client/plugins/index.d.ts +0 -9
  256. package/build/runtime-cjs/client/plugins/index.js +0 -45
  257. package/build/runtime-cjs/client/plugins/injectedPlugins.d.ts +0 -4
  258. package/build/runtime-cjs/client/plugins/injectedPlugins.js +0 -25
  259. package/build/runtime-cjs/client/plugins/mutation.d.ts +0 -2
  260. package/build/runtime-cjs/client/plugins/mutation.js +0 -89
  261. package/build/runtime-cjs/client/plugins/optimisticKeys.d.ts +0 -7
  262. package/build/runtime-cjs/client/plugins/optimisticKeys.js +0 -324
  263. package/build/runtime-cjs/client/plugins/query.d.ts +0 -2
  264. package/build/runtime-cjs/client/plugins/query.js +0 -93
  265. package/build/runtime-cjs/client/plugins/subscription.d.ts +0 -20
  266. package/build/runtime-cjs/client/plugins/subscription.js +0 -114
  267. package/build/runtime-cjs/client/plugins/test.d.ts +0 -15
  268. package/build/runtime-cjs/client/plugins/test.js +0 -118
  269. package/build/runtime-cjs/client/plugins/throwOnError.d.ts +0 -8
  270. package/build/runtime-cjs/client/plugins/throwOnError.js +0 -47
  271. package/build/runtime-cjs/client/utils/documentPlugins.d.ts +0 -3
  272. package/build/runtime-cjs/client/utils/documentPlugins.js +0 -57
  273. package/build/runtime-cjs/client/utils/index.d.ts +0 -1
  274. package/build/runtime-cjs/client/utils/index.js +0 -22
  275. package/build/runtime-cjs/generated.d.ts +0 -5
  276. package/build/runtime-cjs/generated.js +0 -16
  277. package/build/runtime-cjs/imports/config.d.ts +0 -3
  278. package/build/runtime-cjs/imports/config.js +0 -24
  279. package/build/runtime-cjs/imports/pluginConfig.d.ts +0 -3
  280. package/build/runtime-cjs/imports/pluginConfig.js +0 -25
  281. package/build/runtime-cjs/index.d.ts +0 -8
  282. package/build/runtime-cjs/index.js +0 -61
  283. package/build/runtime-cjs/lib/config.d.ts +0 -216
  284. package/build/runtime-cjs/lib/config.js +0 -110
  285. package/build/runtime-cjs/lib/constants.d.ts +0 -6
  286. package/build/runtime-cjs/lib/constants.js +0 -38
  287. package/build/runtime-cjs/lib/deepEquals.js +0 -52
  288. package/build/runtime-cjs/lib/flatten.js +0 -41
  289. package/build/runtime-cjs/lib/index.d.ts +0 -10
  290. package/build/runtime-cjs/lib/index.js +0 -40
  291. package/build/runtime-cjs/lib/key.js +0 -41
  292. package/build/runtime-cjs/lib/log.js +0 -72
  293. package/build/runtime-cjs/lib/lru.js +0 -73
  294. package/build/runtime-cjs/lib/pageInfo.js +0 -79
  295. package/build/runtime-cjs/lib/pagination.js +0 -240
  296. package/build/runtime-cjs/lib/scalars.js +0 -147
  297. package/build/runtime-cjs/lib/selection.js +0 -66
  298. package/build/runtime-cjs/lib/store.d.ts +0 -19
  299. package/build/runtime-cjs/lib/store.js +0 -81
  300. package/build/runtime-cjs/lib/types.js +0 -104
  301. package/build/runtime-cjs/package.json +0 -1
  302. package/build/runtime-cjs/public/cache.d.ts +0 -42
  303. package/build/runtime-cjs/public/cache.js +0 -98
  304. package/build/runtime-cjs/public/index.d.ts +0 -1
  305. package/build/runtime-cjs/public/index.js +0 -28
  306. package/build/runtime-cjs/public/list.d.ts +0 -18
  307. package/build/runtime-cjs/public/list.js +0 -151
  308. package/build/runtime-cjs/public/record.d.ts +0 -40
  309. package/build/runtime-cjs/public/record.js +0 -94
  310. package/build/runtime-cjs/public/tests/test.d.ts +0 -156
  311. package/build/runtime-cjs/public/tests/test.js +0 -60
  312. package/build/runtime-cjs/public/types.d.ts +0 -62
  313. package/build/runtime-cjs/public/types.js +0 -16
  314. package/build/runtime-cjs/router/cookies.js +0 -168
  315. package/build/runtime-cjs/router/jwt.js +0 -168
  316. package/build/runtime-cjs/router/match.js +0 -158
  317. package/build/runtime-cjs/router/server.d.ts +0 -24
  318. package/build/runtime-cjs/router/server.js +0 -117
  319. package/build/runtime-cjs/router/session.js +0 -100
  320. package/build/runtime-cjs/router/types.js +0 -16
  321. package/build/runtime-cjs/server/index.d.ts +0 -17
  322. package/build/runtime-cjs/server/index.js +0 -62
  323. package/build/runtime-esm/cache/cache.d.ts +0 -169
  324. package/build/runtime-esm/cache/constants.d.ts +0 -1
  325. package/build/runtime-esm/cache/gc.d.ts +0 -10
  326. package/build/runtime-esm/cache/index.d.ts +0 -3
  327. package/build/runtime-esm/cache/index.js +0 -5
  328. package/build/runtime-esm/cache/lists.d.ts +0 -89
  329. package/build/runtime-esm/cache/staleManager.d.ts +0 -31
  330. package/build/runtime-esm/cache/storage.d.ts +0 -110
  331. package/build/runtime-esm/cache/stuff.d.ts +0 -2
  332. package/build/runtime-esm/cache/subscription.d.ts +0 -52
  333. package/build/runtime-esm/client/documentStore.d.ts +0 -107
  334. package/build/runtime-esm/client/index.d.ts +0 -50
  335. package/build/runtime-esm/client/index.js +0 -130
  336. package/build/runtime-esm/client/plugins/cache.d.ts +0 -9
  337. package/build/runtime-esm/client/plugins/cache.js +0 -104
  338. package/build/runtime-esm/client/plugins/fetch.d.ts +0 -38
  339. package/build/runtime-esm/client/plugins/fetch.js +0 -184
  340. package/build/runtime-esm/client/plugins/fetchParams.d.ts +0 -9
  341. package/build/runtime-esm/client/plugins/fetchParams.js +0 -23
  342. package/build/runtime-esm/client/plugins/fragment.d.ts +0 -2
  343. package/build/runtime-esm/client/plugins/fragment.js +0 -53
  344. package/build/runtime-esm/client/plugins/index.d.ts +0 -9
  345. package/build/runtime-esm/client/plugins/index.js +0 -12
  346. package/build/runtime-esm/client/plugins/injectedPlugins.d.ts +0 -4
  347. package/build/runtime-esm/client/plugins/injectedPlugins.js +0 -5
  348. package/build/runtime-esm/client/plugins/mutation.d.ts +0 -2
  349. package/build/runtime-esm/client/plugins/mutation.js +0 -65
  350. package/build/runtime-esm/client/plugins/optimisticKeys.d.ts +0 -7
  351. package/build/runtime-esm/client/plugins/optimisticKeys.js +0 -290
  352. package/build/runtime-esm/client/plugins/query.d.ts +0 -2
  353. package/build/runtime-esm/client/plugins/query.js +0 -69
  354. package/build/runtime-esm/client/plugins/subscription.d.ts +0 -20
  355. package/build/runtime-esm/client/plugins/subscription.js +0 -90
  356. package/build/runtime-esm/client/plugins/test.d.ts +0 -15
  357. package/build/runtime-esm/client/plugins/test.js +0 -93
  358. package/build/runtime-esm/client/plugins/throwOnError.d.ts +0 -8
  359. package/build/runtime-esm/client/plugins/throwOnError.js +0 -23
  360. package/build/runtime-esm/client/utils/documentPlugins.d.ts +0 -3
  361. package/build/runtime-esm/client/utils/documentPlugins.js +0 -33
  362. package/build/runtime-esm/client/utils/index.d.ts +0 -1
  363. package/build/runtime-esm/client/utils/index.js +0 -1
  364. package/build/runtime-esm/generated.d.ts +0 -5
  365. package/build/runtime-esm/generated.js +0 -0
  366. package/build/runtime-esm/imports/config.d.ts +0 -3
  367. package/build/runtime-esm/imports/config.js +0 -4
  368. package/build/runtime-esm/imports/pluginConfig.d.ts +0 -3
  369. package/build/runtime-esm/imports/pluginConfig.js +0 -5
  370. package/build/runtime-esm/index.d.ts +0 -8
  371. package/build/runtime-esm/index.js +0 -22
  372. package/build/runtime-esm/lib/config.d.ts +0 -216
  373. package/build/runtime-esm/lib/constants.d.ts +0 -6
  374. package/build/runtime-esm/lib/deepEquals.d.ts +0 -1
  375. package/build/runtime-esm/lib/flatten.d.ts +0 -2
  376. package/build/runtime-esm/lib/index.d.ts +0 -10
  377. package/build/runtime-esm/lib/index.js +0 -10
  378. package/build/runtime-esm/lib/key.d.ts +0 -6
  379. package/build/runtime-esm/lib/log.d.ts +0 -6
  380. package/build/runtime-esm/lib/lru.d.ts +0 -52
  381. package/build/runtime-esm/lib/pageInfo.d.ts +0 -7
  382. package/build/runtime-esm/lib/pagination.d.ts +0 -27
  383. package/build/runtime-esm/lib/scalars.d.ts +0 -14
  384. package/build/runtime-esm/lib/selection.d.ts +0 -2
  385. package/build/runtime-esm/lib/store.d.ts +0 -19
  386. package/build/runtime-esm/lib/types.d.ts +0 -417
  387. package/build/runtime-esm/public/cache.d.ts +0 -42
  388. package/build/runtime-esm/public/cache.js +0 -74
  389. package/build/runtime-esm/public/index.d.ts +0 -1
  390. package/build/runtime-esm/public/index.js +0 -4
  391. package/build/runtime-esm/public/list.d.ts +0 -18
  392. package/build/runtime-esm/public/list.js +0 -127
  393. package/build/runtime-esm/public/record.d.ts +0 -40
  394. package/build/runtime-esm/public/record.js +0 -70
  395. package/build/runtime-esm/public/tests/test.d.ts +0 -156
  396. package/build/runtime-esm/public/tests/test.js +0 -36
  397. package/build/runtime-esm/public/types.d.ts +0 -62
  398. package/build/runtime-esm/router/cookies.d.ts +0 -41
  399. package/build/runtime-esm/router/jwt.d.ts +0 -117
  400. package/build/runtime-esm/router/match.d.ts +0 -39
  401. package/build/runtime-esm/router/server.d.ts +0 -24
  402. package/build/runtime-esm/router/session.d.ts +0 -22
  403. package/build/runtime-esm/router/types.d.ts +0 -26
  404. package/build/runtime-esm/router/types.js +0 -0
  405. package/build/runtime-esm/server/index.d.ts +0 -17
  406. package/build/runtime-esm/server/index.js +0 -38
  407. package/build/test-cjs/index.js +0 -74658
  408. package/build/test-cjs/package.json +0 -1
  409. package/build/test-esm/index.js +0 -74653
  410. package/build/vite/imports.d.ts +0 -40
  411. package/build/vite-cjs/index.js +0 -85695
  412. package/build/vite-cjs/package.json +0 -1
  413. package/build/vite-esm/index.js +0 -85687
  414. /package/build/{adapter-esm → adapter}/package.json +0 -0
  415. /package/build/{cmd-esm → cmd}/package.json +0 -0
  416. /package/build/{codegen-esm → lib}/package.json +0 -0
  417. /package/build/{lib-esm → node}/package.json +0 -0
  418. /package/build/{runtime-cjs/router → router}/cookies.d.ts +0 -0
  419. /package/build/{runtime-cjs/router → router}/jwt.d.ts +0 -0
  420. /package/build/{runtime-esm → router}/package.json +0 -0
  421. /package/build/{runtime-cjs/router → router}/session.d.ts +0 -0
  422. /package/build/{runtime-esm/public → router}/types.js +0 -0
  423. /package/build/{runtime-esm → runtime}/cache/constants.js +0 -0
  424. /package/build/{runtime-esm → runtime}/cache/stuff.js +0 -0
  425. /package/build/{runtime-esm/lib → runtime}/constants.js +0 -0
  426. /package/build/{runtime-cjs/lib → runtime}/deepEquals.d.ts +0 -0
  427. /package/build/{runtime-esm/lib → runtime}/flatten.js +0 -0
  428. /package/build/{runtime-cjs/lib → runtime}/log.d.ts +0 -0
  429. /package/build/{runtime-cjs/lib → runtime}/lru.d.ts +0 -0
  430. /package/build/{runtime-esm/lib → runtime}/lru.js +0 -0
  431. /package/build/{test-esm → runtime}/package.json +0 -0
  432. /package/build/{vite-esm → test}/package.json +0 -0
@@ -1,3 +1,3 @@
1
- import type { serverAdapterFactory as createAdapter } from '../runtime/router/server';
1
+ import type { serverAdapterFactory as createAdapter } from '../router/server';
2
2
  export declare const endpoint: string;
3
- export declare let createServerAdapter: (args: Omit<Parameters<typeof createAdapter>[0], 'on_render' | 'manifest' | 'server' | 'schema' | 'graphqlEndpoint' | 'componentCache' | 'client'>) => ReturnType<typeof createAdapter>;
3
+ export declare let createServerAdapter: (args: Omit<Parameters<typeof createAdapter>[0], 'on_render' | 'manifest' | 'yoga' | 'schema' | 'graphqlEndpoint' | 'componentCache' | 'client' | 'config_file'>) => ReturnType<typeof createAdapter>;
@@ -0,0 +1,6 @@
1
+ const endpoint = "";
2
+ let createServerAdapter;
3
+ export {
4
+ createServerAdapter,
5
+ endpoint
6
+ };
@@ -1,3 +1,4 @@
1
+ import { type PipelineHook } from '../lib/index.js';
1
2
  export declare function generate(args?: {
2
3
  pullSchema: boolean;
3
4
  persistOutput?: string;
@@ -5,4 +6,8 @@ export declare function generate(args?: {
5
6
  headers: string[];
6
7
  log?: string;
7
8
  verbose: boolean;
9
+ mode?: string;
10
+ preserveDatabase: boolean;
11
+ afterPhase?: PipelineHook;
12
+ beforePhase?: PipelineHook;
8
13
  }): Promise<void>;
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { format_error } from "../lib/error.js";
4
+ import {
5
+ codegen_setup,
6
+ init_db,
7
+ run_pipeline,
8
+ PIPELINE_HOOKS
9
+ } from "../lib/index.js";
10
+ import { get_config } from "../lib/project.js";
11
+ import pull_schema from "./pullSchema.js";
12
+ async function generate(args = {
13
+ pullSchema: false,
14
+ headers: [],
15
+ verbose: false,
16
+ preserveDatabase: false
17
+ }) {
18
+ const mode = args.mode ?? "development";
19
+ let on_close = async () => {
20
+ };
21
+ if (args.pullSchema) {
22
+ await pull_schema({ headers: args.headers, output: args.output });
23
+ }
24
+ try {
25
+ const config = await get_config();
26
+ const [db, dbFilepath] = await init_db(config, args.preserveDatabase);
27
+ const { trigger_hook, close } = await codegen_setup(config, mode, db, dbFilepath);
28
+ on_close = async () => {
29
+ try {
30
+ await close();
31
+ process.exit(0);
32
+ } catch (_error) {
33
+ process.exit(1);
34
+ }
35
+ };
36
+ process.on("SIGINT", on_close);
37
+ process.on("SIGTERM", on_close);
38
+ if (args.afterPhase && !PIPELINE_HOOKS.includes(args.afterPhase)) {
39
+ throw new Error(
40
+ `Invalid --after-phase: ${args.afterPhase}. Valid phases are: ${PIPELINE_HOOKS.join(
41
+ ", "
42
+ )}`
43
+ );
44
+ }
45
+ if (args.beforePhase && !PIPELINE_HOOKS.includes(args.beforePhase)) {
46
+ throw new Error(
47
+ `Invalid --before-phase: ${args.beforePhase}. Valid phases are: ${PIPELINE_HOOKS.join(", ")}`
48
+ );
49
+ }
50
+ const pipelineOptions = {
51
+ after: "Schema"
52
+ };
53
+ if (args.afterPhase) {
54
+ pipelineOptions.after = args.afterPhase;
55
+ }
56
+ if (args.beforePhase) {
57
+ pipelineOptions.through = args.beforePhase;
58
+ }
59
+ const results = await run_pipeline(trigger_hook, pipelineOptions);
60
+ const docCount = Object.values(results.GenerateDocuments ?? {}).flat().length;
61
+ console.log(`\u{1F3A9} Generated ${docCount} ${docCount === 1 ? "document" : "documents"}`);
62
+ await on_close();
63
+ } catch (e) {
64
+ format_error(e, (error) => {
65
+ console.error(error.stack?.split("\n").slice(1).join("\n"));
66
+ });
67
+ try {
68
+ on_close();
69
+ } catch (closeError) {
70
+ console.error("Error closing plugins:", closeError);
71
+ }
72
+ process.exit(1);
73
+ }
74
+ }
75
+ export {
76
+ generate
77
+ };
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { Command } from "commander";
4
+ import { generate } from "./generate.js";
5
+ import { init } from "./init.js";
6
+ import pullSchema from "./pullSchema.js";
7
+ const program = new Command();
8
+ program.command("generate").description("generate the application runtime").option("-p, --pull-schema", "pull the latest schema before generating").option("-r, --preserve-database", "preserve any existing generated logic").option("-o, --output [outputPath]", "persist queries to a queryMap file").option(
9
+ "-h, --headers <headers...>",
10
+ "headers to use when pulling your schema. Should be passed as KEY=VALUE"
11
+ ).option("-v, --verbose", "verbose error messages").option(
12
+ "--after-phase <phase>",
13
+ "start the pipeline after the specified phase (Config, AfterLoad, Schema, ExtractDocuments, AfterExtract, BeforeValidate, Validate, AfterValidate, BeforeGenerate, GenerateDocuments, GenerateRuntime, AfterGenerate)"
14
+ ).option(
15
+ "--before-phase <phase>",
16
+ "run the pipeline up to and including the specified phase (Config, AfterLoad, Schema, ExtractDocuments, AfterExtract, BeforeValidate, Validate, AfterValidate, BeforeGenerate, GenerateDocuments, GenerateRuntime, AfterGenerate)"
17
+ ).action(generate);
18
+ program.command("init").arguments("[path]").usage("[path] [options]").description("initialize a new houdini project").option(
19
+ "-h, --headers <headers...>",
20
+ "header to use when pulling your schema. Should be passed as KEY=VALUE"
21
+ ).option("-y, --yes", "dont prompt for input. uses default values or empty strings").action(init);
22
+ program.command("pull-schema").usage("[options]").description("pull the latest schema from your api").option("-o, --output [outputPath]", "the destination for the schema contents").option(
23
+ "-h, --headers <headers...>",
24
+ "headers to use when pulling your schema. Should be passed as KEY=VALUE"
25
+ ).action(pullSchema);
26
+ program.parse();
27
+ process.on("unhandledRejection", (error) => {
28
+ if ("description" in error) {
29
+ } else {
30
+ console.log(error);
31
+ }
32
+ });
@@ -0,0 +1,530 @@
1
+ #!/usr/bin/env node
2
+
3
+ import * as p from "@clack/prompts";
4
+ import { bold, cyan, gray, green, italic } from "kleur/colors";
5
+ import { execSync } from "node:child_process";
6
+ import { fs, path } from "../lib/index.js";
7
+ import { pull_schema } from "../lib/schema.js";
8
+ function pCancel(cancelText = "Operation cancelled.") {
9
+ p.cancel(cancelText);
10
+ process.exit(1);
11
+ }
12
+ async function init(_path, args) {
13
+ p.intro("\u{1F3A9} Welcome to Houdini!");
14
+ try {
15
+ await fs.stat(path.resolve("./src"));
16
+ } catch {
17
+ throw new Error(
18
+ "Please initialize your project first before running init. For svelte projects, you should follow the instructions here: https://kit.svelte.dev/"
19
+ );
20
+ }
21
+ const headers = extractHeaders(args.headers);
22
+ const targetPath = _path ? path.resolve(_path) : process.cwd();
23
+ let use_git = false;
24
+ let dir = targetPath;
25
+ do {
26
+ if (fs.existsSync(path.join(dir, ".git"))) {
27
+ use_git = true;
28
+ break;
29
+ }
30
+ } while (dir !== (dir = path.dirname(dir)));
31
+ if (use_git) {
32
+ const status = execSync("git status --porcelain", {
33
+ stdio: "pipe"
34
+ }).toString();
35
+ if (status) {
36
+ const { confirm } = await p.group(
37
+ {
38
+ confirm: () => {
39
+ p.log.warning(
40
+ `Your git working directory is dirty \u2014 we recommend committing your changes before running this migration.`
41
+ );
42
+ return p.confirm({
43
+ message: `Continue anyway?`,
44
+ initialValue: false
45
+ });
46
+ }
47
+ },
48
+ {
49
+ onCancel: () => pCancel()
50
+ }
51
+ );
52
+ if (confirm !== true) {
53
+ pCancel();
54
+ }
55
+ }
56
+ }
57
+ let url = "http://localhost:5173/api/graphql";
58
+ let is_remote_endpoint = true;
59
+ if (!args.yes) {
60
+ is_remote_endpoint = (await p.group(
61
+ {
62
+ is_remote_endpoint: () => p.confirm({
63
+ message: "Will you use a remote GraphQL API?",
64
+ initialValue: true
65
+ })
66
+ },
67
+ {
68
+ onCancel: () => pCancel()
69
+ }
70
+ )).is_remote_endpoint;
71
+ }
72
+ let schemaPath = is_remote_endpoint ? "./schema.graphql" : "path/to/src/lib/**/*.graphql";
73
+ let pullSchema_content = null;
74
+ if (is_remote_endpoint && !args.yes) {
75
+ let number_of_round = 0;
76
+ let url_and_headers = "";
77
+ while (pullSchema_content === null && number_of_round < 10) {
78
+ number_of_round++;
79
+ const answer = await p.group(
80
+ {
81
+ url_and_headers: async () => p.text({
82
+ message: `What's the URL for your api? ${number_of_round === 1 ? "" : `(attempt ${number_of_round})`}`,
83
+ placeholder: `http://localhost:4000/graphql ${number_of_round === 1 ? "" : "Authorization=Bearer MyToken"}`,
84
+ validate: (value) => {
85
+ if (value === "") {
86
+ return;
87
+ }
88
+ if (!value.startsWith("http")) {
89
+ return "Please enter a valid URL";
90
+ }
91
+ }
92
+ })
93
+ },
94
+ {
95
+ onCancel: () => pCancel()
96
+ }
97
+ );
98
+ url_and_headers = answer.url_and_headers;
99
+ const value_splited = url_and_headers.split(" ");
100
+ const local_url = value_splited[0];
101
+ const local_headers = value_splited.length > 1 ? extractHeadersStr(value_splited.slice(1).join(" ")) : headers;
102
+ const fetchTimeout = 3e4;
103
+ pullSchema_content = await pull_schema(
104
+ local_url,
105
+ fetchTimeout,
106
+ schemaPath,
107
+ local_headers,
108
+ true
109
+ );
110
+ if (pullSchema_content === null) {
111
+ const msg = `If you need to pass headers, add them after the URL (eg: '${green(
112
+ `http://myurl.com/graphql Authorization=Bearer MyToken`
113
+ )}')`;
114
+ p.log.error(msg);
115
+ }
116
+ url = url_and_headers === "" ? "http://localhost:4000/graphql" : local_url;
117
+ }
118
+ if (pullSchema_content === null) {
119
+ pCancel("We couldn't pull the schema. Please check your URL/headers and try again.");
120
+ }
121
+ } else if (!args.yes) {
122
+ const answers = await p.group(
123
+ {
124
+ schema_path: () => p.text({
125
+ message: "Where is your schema located?",
126
+ placeholder: schemaPath,
127
+ validate: (value) => {
128
+ if (value === "") {
129
+ return "Please enter a valid schemaPath";
130
+ }
131
+ }
132
+ })
133
+ },
134
+ {
135
+ onCancel: () => pCancel()
136
+ }
137
+ );
138
+ schemaPath = answers.schema_path;
139
+ }
140
+ if (is_remote_endpoint && pullSchema_content) {
141
+ await fs.writeFile(path.join(targetPath, schemaPath), pullSchema_content);
142
+ }
143
+ const { frameworkInfo, typescript, module, package_manager } = await detectTools(targetPath);
144
+ const found_to_log = [];
145
+ if (frameworkInfo.framework === "svelte") {
146
+ found_to_log.push("\u2728 Svelte");
147
+ } else if (frameworkInfo.framework === "kit") {
148
+ found_to_log.push("\u2728 SvelteKit");
149
+ } else {
150
+ throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
151
+ }
152
+ if (module === "esm") {
153
+ found_to_log.push("\u{1F4E6} ES Modules");
154
+ } else {
155
+ found_to_log.push("\u{1F4E6} CommonJS");
156
+ }
157
+ if (typescript) {
158
+ found_to_log.push("\u{1F7E6} TypeScript");
159
+ } else {
160
+ found_to_log.push("\u{1F7E8} JavaScript");
161
+ }
162
+ p.log.info(`Here's what we found: ${found_to_log.join(", ")}`);
163
+ const sourceDir = path.join(targetPath, "src");
164
+ const configPath = path.join(targetPath, "houdini.config.js");
165
+ const s = p.spinner();
166
+ s.start(`\u{1F6A7} Generating houdini's files...`);
167
+ const runtimeDir = ".houdini";
168
+ await houdiniConfig(
169
+ configPath,
170
+ schemaPath,
171
+ module,
172
+ frameworkInfo,
173
+ is_remote_endpoint ? url : null,
174
+ runtimeDir
175
+ );
176
+ await houdiniClient(sourceDir, typescript, frameworkInfo, url);
177
+ if (frameworkInfo.framework === "svelte") {
178
+ await svelteKitConfig(targetPath, typescript);
179
+ } else if (frameworkInfo.framework === "kit") {
180
+ await svelteConfig(targetPath, typescript);
181
+ }
182
+ await gitIgnore({
183
+ targetPath,
184
+ schemaPath: is_remote_endpoint ? schemaPath : void 0
185
+ });
186
+ await graphqlRC(targetPath, runtimeDir);
187
+ await viteConfig(targetPath, frameworkInfo, typescript);
188
+ await tjsConfig(targetPath, frameworkInfo);
189
+ await packageJSON(targetPath, frameworkInfo);
190
+ s.stop(`Houdini's files generated ${green("\u2713")}`);
191
+ p.outro("\u{1F389} Everything is ready!");
192
+ finale_logs(package_manager);
193
+ }
194
+ function finale_logs(package_manager) {
195
+ let cmd_install = "npm i";
196
+ let cmd_run = "npm run dev";
197
+ if (package_manager === "pnpm") {
198
+ cmd_install = "pnpm i";
199
+ cmd_run = "pnpm dev";
200
+ } else if (package_manager === "yarn") {
201
+ cmd_install = "yarn";
202
+ cmd_run = "yarn dev";
203
+ }
204
+ console.log(`\u{1F449} Next Steps`);
205
+ console.log(`1 Finalize your installation: ${green(cmd_install)}
206
+ 2 Start your application: ${green(cmd_run)}
207
+ `);
208
+ console.log(
209
+ gray(
210
+ italic(
211
+ `${bold("\u2754 More help")} at ${cyan(
212
+ "https://houdinigraphql.com"
213
+ )} (\u{1F4C4} Docs, \u2B50 Github, \u{1F4E3} Discord, ...)
214
+ `
215
+ )
216
+ )
217
+ );
218
+ }
219
+ async function houdiniConfig(configPath, schemaPath, module, frameworkInfo, url, runtimeDir) {
220
+ const config = {};
221
+ if (url !== null) {
222
+ config.watchSchema = {
223
+ url
224
+ };
225
+ }
226
+ config.runtimeDir = runtimeDir;
227
+ if (schemaPath !== "./schema.graphql") {
228
+ config.schemaPath = schemaPath;
229
+ }
230
+ if (module !== "esm") {
231
+ config.module = module;
232
+ }
233
+ if (frameworkInfo.framework === "svelte") {
234
+ config.plugins = {
235
+ "houdini-svelte": {
236
+ framework: "svelte"
237
+ }
238
+ };
239
+ } else if (frameworkInfo.framework === "kit") {
240
+ config.plugins = {
241
+ "houdini-svelte": {}
242
+ };
243
+ }
244
+ const configObj = JSON.stringify(config, null, 4);
245
+ const content_base = `/// <references types="houdini-svelte">
246
+
247
+ /** @type {import('houdini').ConfigFile} */
248
+ const config = ${configObj}`;
249
+ const content = module === "esm" ? `${content_base}
250
+
251
+ export default config
252
+ ` : `${content_base}
253
+
254
+ module.exports = config
255
+ `;
256
+ await fs.writeFile(configPath, content);
257
+ return false;
258
+ }
259
+ async function houdiniClient(targetPath, typescript, _frameworkInfo, url) {
260
+ const houdiniClientExt = typescript ? `ts` : `js`;
261
+ const houdiniClientPath = path.join(targetPath, `client.${houdiniClientExt}`);
262
+ const content = `import { HoudiniClient } from '$houdini';
263
+
264
+ export default new HoudiniClient({
265
+ url: '${url}'
266
+
267
+ // uncomment this to configure the network call (for things like authentication)
268
+ // for more information, please visit here: https://www.houdinigraphql.com/guides/authentication
269
+ // fetchParams({ session }) {
270
+ // return {
271
+ // headers: {
272
+ // Authorization: \`Bearer \${session.token}\`,
273
+ // }
274
+ // }
275
+ // }
276
+ })
277
+ `;
278
+ await fs.writeFile(houdiniClientPath, content);
279
+ }
280
+ async function svelteKitConfig(targetPath, typescript) {
281
+ const svelteMainJsPath = path.join(targetPath, "src", typescript ? "main.ts" : "main.js");
282
+ const newContent = `import client from "./client";
283
+ import './app.css'
284
+ import App from './App.svelte'
285
+
286
+ const app = new App({
287
+ target: document.getElementById('app')
288
+ })
289
+
290
+ export default app
291
+ `;
292
+ await fs.writeFile(svelteMainJsPath, newContent);
293
+ }
294
+ async function svelteConfig(targetPath, typescript) {
295
+ const svelteConfigPath = path.join(targetPath, "svelte.config.js");
296
+ const newContentTs = `import adapter from '@sveltejs/adapter-auto';
297
+ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
298
+
299
+ /** @type {import('@sveltejs/kit').Config} */
300
+ const config = {
301
+ // Consult https://kit.svelte.dev/docs/integrations#preprocessors
302
+ // for more information about preprocessors
303
+ preprocess: vitePreprocess(),
304
+
305
+ kit: {
306
+ adapter: adapter(),
307
+ alias: {
308
+ $houdini: '.houdini/'
309
+ }
310
+ }
311
+ };
312
+
313
+ export default config;
314
+ `;
315
+ const newContentJs = `import adapter from '@sveltejs/adapter-auto';
316
+
317
+ /** @type {import('@sveltejs/kit').Config} */
318
+ const config = {
319
+ kit: {
320
+ adapter: adapter(),
321
+ alias: {
322
+ $houdini: '.houdini/'
323
+ }
324
+ }
325
+ };
326
+
327
+ export default config;
328
+ `;
329
+ await fs.writeFile(svelteConfigPath, typescript ? newContentTs : newContentJs);
330
+ }
331
+ async function gitIgnore({ targetPath, schemaPath }) {
332
+ const filepath = path.join(targetPath, ".gitignore");
333
+ const existing = await fs.readFile(filepath) || "";
334
+ let newIgnores = "";
335
+ if (!existing.includes("\n.houdini\n")) {
336
+ newIgnores += ".houdini\n";
337
+ }
338
+ if (schemaPath && !existing.includes(`
339
+ ${schemaPath}
340
+ `)) {
341
+ newIgnores += `${schemaPath}
342
+ `;
343
+ }
344
+ if (newIgnores) {
345
+ await fs.writeFile(filepath, `${existing}
346
+ ${newIgnores}`);
347
+ }
348
+ }
349
+ async function graphqlRC(targetPath, runtimeDir) {
350
+ const target = path.join(targetPath, ".graphqlrc.yaml");
351
+ const content = `projects:
352
+ default:
353
+ schema:
354
+ - ./schema.graphql
355
+ - ./${runtimeDir}/graphql/schema.graphql
356
+ documents:
357
+ - '**/*.gql'
358
+ - '**/*.svelte'
359
+ - ./${runtimeDir}/graphql/documents.gql
360
+ `;
361
+ await fs.writeFile(target, content);
362
+ }
363
+ async function viteConfig(targetPath, frameworkInfo, typescript) {
364
+ const viteConfigPath = path.join(targetPath, typescript ? "vite.config.ts" : "vite.config.js");
365
+ let content = "NO_CONTENT_THIS_SHOULD_NEVER_BE_SEEN";
366
+ if (frameworkInfo.framework === "svelte") {
367
+ content = `import { svelte } from '@sveltejs/vite-plugin-svelte'
368
+ import houdini from 'houdini/vite'
369
+ import * as path from 'path'
370
+ import { defineConfig } from 'vite'
371
+
372
+ export default defineConfig({
373
+ plugins: [houdini(), svelte()],
374
+
375
+ resolve: {
376
+ alias: {
377
+ $houdini: '.houdini/',
378
+ },
379
+ },
380
+ })
381
+ `;
382
+ } else if (frameworkInfo.framework === "kit") {
383
+ content = `import { sveltekit } from '@sveltejs/kit/vite'
384
+ import houdini from 'houdini/vite'
385
+ import { defineConfig } from 'vite'
386
+
387
+ export default defineConfig({
388
+ plugins: [houdini(), sveltekit()]
389
+ });
390
+ `;
391
+ } else {
392
+ throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
393
+ }
394
+ await fs.writeFile(viteConfigPath, content);
395
+ }
396
+ async function tjsConfig(targetPath, frameworkInfo) {
397
+ let configFile = path.join(targetPath, "tsconfig.json");
398
+ try {
399
+ await fs.stat(configFile);
400
+ } catch {
401
+ configFile = path.join(targetPath, "jsconfig.json");
402
+ try {
403
+ await fs.stat(configFile);
404
+ } catch {
405
+ return false;
406
+ }
407
+ }
408
+ let tjsConfig2;
409
+ try {
410
+ const tjsConfigFile = await fs.readFile(configFile);
411
+ if (tjsConfigFile) {
412
+ tjsConfig2 = parseJSON(tjsConfigFile);
413
+ }
414
+ if (frameworkInfo.framework === "svelte") {
415
+ tjsConfig2.compilerOptions.rootDirs = [".", "./.houdini/types"];
416
+ } else if (frameworkInfo.framework === "kit") {
417
+ tjsConfig2.compilerOptions.rootDirs = [".", "./.svelte-kit/types", "./.houdini/types"];
418
+ }
419
+ if (frameworkInfo.framework === "svelte") {
420
+ tjsConfig2.compilerOptions.paths = {
421
+ ...tjsConfig2.compilerOptions.paths,
422
+ $houdini: ["./.houdini/"],
423
+ "$houdini/*": ["./.houdini/*"]
424
+ };
425
+ }
426
+ await fs.writeFile(configFile, JSON.stringify(tjsConfig2, null, 4));
427
+ } catch {
428
+ }
429
+ return false;
430
+ }
431
+ async function packageJSON(targetPath, frameworkInfo) {
432
+ let packageJSON2 = {};
433
+ const packagePath = path.join(targetPath, "package.json");
434
+ const packageFile = await fs.readFile(packagePath);
435
+ if (packageFile) {
436
+ packageJSON2 = JSON.parse(packageFile);
437
+ }
438
+ packageJSON2.devDependencies = {
439
+ ...packageJSON2.devDependencies,
440
+ houdini: "^2.0.0-next.22"
441
+ };
442
+ if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
443
+ packageJSON2.devDependencies = {
444
+ ...packageJSON2.devDependencies,
445
+ "houdini-svelte": "^3.0.0-next.23"
446
+ };
447
+ } else {
448
+ throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
449
+ }
450
+ await fs.writeFile(packagePath, JSON.stringify(packageJSON2, null, 4));
451
+ }
452
+ async function detectFromPackageJSON(cwd) {
453
+ let packageJSON2;
454
+ try {
455
+ const packageJSONFile = await fs.readFile(path.join(cwd, "package.json"));
456
+ if (packageJSONFile) {
457
+ packageJSON2 = JSON.parse(packageJSONFile);
458
+ } else {
459
+ throw new Error("not found");
460
+ }
461
+ } catch {
462
+ throw new Error(
463
+ "\u274C houdini init must target an existing node project (with a package.json)"
464
+ );
465
+ }
466
+ const { devDependencies, dependencies } = packageJSON2;
467
+ const hasDependency = (dep) => Boolean(devDependencies?.[dep] || dependencies?.[dep]);
468
+ let frameworkInfo = { framework: "svelte" };
469
+ if (hasDependency("@sveltejs/kit")) {
470
+ frameworkInfo = { framework: "kit" };
471
+ }
472
+ return {
473
+ frameworkInfo,
474
+ module: packageJSON2.type === "module" ? "esm" : "commonjs"
475
+ };
476
+ }
477
+ async function detectTools(cwd = process.cwd()) {
478
+ let typescript = false;
479
+ try {
480
+ await fs.stat(path.join(cwd, "tsconfig.json"));
481
+ typescript = true;
482
+ } catch {
483
+ }
484
+ let package_manager = "npm";
485
+ let dir = cwd;
486
+ do {
487
+ if (fs.existsSync(path.join(dir, "pnpm-lock.yaml"))) {
488
+ package_manager = "pnpm";
489
+ break;
490
+ }
491
+ if (fs.existsSync(path.join(dir, "yarn.lock"))) {
492
+ package_manager = "yarn";
493
+ break;
494
+ }
495
+ } while (dir !== (dir = path.dirname(dir)));
496
+ return {
497
+ typescript,
498
+ package_manager,
499
+ ...await detectFromPackageJSON(cwd)
500
+ };
501
+ }
502
+ function parseJSON(str) {
503
+ str = str.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (m, g) => g ? "" : m);
504
+ return JSON.parse(str);
505
+ }
506
+ function extractHeadersStr(str) {
507
+ const regex = /(\w+)=("[^"]*"|[^ ]*)/g;
508
+ const obj = {};
509
+ let match;
510
+ while ((match = regex.exec(str ?? "")) !== null) {
511
+ obj[match[1]] = match[2].replaceAll('"', "");
512
+ }
513
+ return obj;
514
+ }
515
+ function extractHeaders(headers) {
516
+ if ((headers ?? []).length > 0) {
517
+ return headers.reduce((total, header) => {
518
+ const [key, value] = header.split(/=(.*)/s);
519
+ return {
520
+ ...total,
521
+ [key]: value.replaceAll('"', "")
522
+ };
523
+ }, {});
524
+ }
525
+ return {};
526
+ }
527
+ export {
528
+ finale_logs,
529
+ init
530
+ };
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+
3
+ import * as path from "../lib/path.js";
4
+ import { get_config } from "../lib/project.js";
5
+ import { pull_schema } from "../lib/schema.js";
6
+ async function pullSchema_default(args) {
7
+ const config = await get_config({ skip_schema: true });
8
+ const apiURL = await config.api_url();
9
+ if (!apiURL) {
10
+ console.log(
11
+ "\u274C Your project does not have a remote endpoint configured. Please provide one with the `apiUrl` value in your houdini.config.js file."
12
+ );
13
+ process.exit(1);
14
+ }
15
+ const headers = await config.schema_pull_headers();
16
+ const targetPath = args.output ? path.resolve(args.output) : config.config_file.schemaPath ?? path.resolve(process.cwd(), "schema.json");
17
+ await pull_schema(apiURL, config.config_file.watchSchema?.timeout ?? 3e4, targetPath, headers);
18
+ }
19
+ export {
20
+ pullSchema_default as default
21
+ };
@@ -12,5 +12,5 @@ export declare function find_exported_fn(body: Statement[], name: string): {
12
12
  declaration: FunctionDeclaration | FunctionExpression | ArrowFunctionExpression | null | Identifier | CallExpression;
13
13
  export: ExportNamedDeclaration;
14
14
  } | null;
15
- export declare function find_exported_id(program: Program, name: string): recast.types.namedTypes.ExportNamedDeclaration | undefined;
15
+ export declare function find_exported_id(program: Program, name: string): recast.types.namedTypes.ExportNamedDeclaration;
16
16
  export {};