xanix 1.0.18 → 1.0.19

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 (350) hide show
  1. package/dist/AppRoot.d.ts +6 -0
  2. package/dist/AppRoot.js +15 -0
  3. package/dist/bin/bundler/Cache.d.ts +1 -0
  4. package/dist/bin/bundler/Cache.js +210 -0
  5. package/dist/bin/bundler/External.d.ts +3 -0
  6. package/dist/bin/bundler/External.js +6 -0
  7. package/dist/bin/bundler/buildClient.js +2 -2
  8. package/dist/bin/bundler/buildServer.js +2 -2
  9. package/dist/bin/bundler/cache/buildCache.d.ts +3 -0
  10. package/dist/bin/bundler/cache/buildCache.js +76 -0
  11. package/dist/bin/bundler/cache/index.d.ts +3 -0
  12. package/dist/bin/bundler/cache/index.js +216 -0
  13. package/dist/bin/bundler/cache/manifest.d.ts +3 -0
  14. package/dist/bin/bundler/cache/manifest.js +27 -0
  15. package/dist/bin/bundler/cache/plugin/Transformer.d.ts +3 -0
  16. package/dist/bin/bundler/cache/plugin/Transformer.js +42 -0
  17. package/dist/bin/bundler/cache/types.d.ts +8 -0
  18. package/dist/bin/bundler/cache/types.js +1 -0
  19. package/dist/bin/bundler/cache/utils.d.ts +5 -0
  20. package/dist/bin/bundler/cache/utils.js +56 -0
  21. package/dist/bin/bundler/client/build.d.ts +2 -0
  22. package/dist/bin/bundler/client/build.js +61 -0
  23. package/dist/bin/bundler/client/plugins/Transformer/TransformCache.d.ts +15 -0
  24. package/dist/bin/bundler/client/plugins/Transformer/TransformCache.js +39 -0
  25. package/dist/bin/bundler/client/plugins/Transformer/TransformCacheFunction.d.ts +3 -0
  26. package/dist/bin/bundler/client/plugins/Transformer/TransformCacheFunction.js +32 -0
  27. package/dist/bin/bundler/client/plugins/Transformer/TransformCreateSession.d.ts +3 -0
  28. package/dist/bin/bundler/client/plugins/Transformer/TransformCreateSession.js +29 -0
  29. package/dist/bin/bundler/client/plugins/Transformer/TransformExpress.d.ts +9 -0
  30. package/dist/bin/bundler/client/plugins/Transformer/TransformExpress.js +26 -0
  31. package/dist/bin/bundler/client/plugins/Transformer/TransformPage.d.ts +29 -0
  32. package/dist/bin/bundler/client/plugins/Transformer/TransformPage.js +77 -0
  33. package/dist/bin/bundler/client/plugins/Transformer/TransformReactContext.d.ts +17 -0
  34. package/dist/bin/bundler/client/plugins/Transformer/TransformReactContext.js +101 -0
  35. package/dist/bin/bundler/client/plugins/Transformer/TransformServerAction.d.ts +15 -0
  36. package/dist/bin/bundler/client/plugins/Transformer/TransformServerAction.js +42 -0
  37. package/dist/bin/bundler/client/plugins/Transformer/TransformServerFunction.d.ts +3 -0
  38. package/dist/bin/bundler/client/plugins/Transformer/TransformServerFunction.js +32 -0
  39. package/dist/bin/bundler/client/plugins/Transformer/TransformUseServer.d.ts +3 -0
  40. package/dist/bin/bundler/client/plugins/Transformer/TransformUseServer.js +31 -0
  41. package/dist/bin/bundler/client/plugins/Transformer/transformModuleCache.d.ts +15 -0
  42. package/dist/bin/bundler/client/plugins/Transformer/transformModuleCache.js +120 -0
  43. package/dist/bin/bundler/client/plugins/Transformer copy.d.ts +3 -0
  44. package/dist/bin/bundler/client/plugins/Transformer copy.js +70 -0
  45. package/dist/bin/bundler/client/plugins/Transformer.d.ts +3 -0
  46. package/dist/bin/bundler/client/plugins/Transformer.js +26 -0
  47. package/dist/bin/bundler/client/plugins/VirtualDev.d.ts +2 -0
  48. package/dist/bin/bundler/client/plugins/VirtualDev.js +34 -0
  49. package/dist/bin/bundler/client/plugins/XanixPages.d.ts +2 -0
  50. package/dist/bin/bundler/client/plugins/XanixPages.js +37 -0
  51. package/dist/bin/bundler/client/plugins/XanixReactRefresh.d.ts +2 -0
  52. package/dist/bin/bundler/client/plugins/XanixReactRefresh.js +22 -0
  53. package/dist/bin/bundler/client/plugins/replacer/cacheFunctionReplacer.d.ts +3 -0
  54. package/dist/bin/bundler/client/plugins/replacer/cacheFunctionReplacer.js +28 -0
  55. package/dist/bin/bundler/client/plugins/replacer/serverFunctionReplacer.d.ts +3 -0
  56. package/dist/bin/bundler/client/plugins/replacer/serverFunctionReplacer.js +28 -0
  57. package/dist/bin/bundler/client/plugins/replacer/useServerReplacer.d.ts +3 -0
  58. package/dist/bin/bundler/client/plugins/replacer/useServerReplacer.js +38 -0
  59. package/dist/bin/bundler/client/watch.config.d.ts +3 -0
  60. package/dist/bin/bundler/client/watch.config.js +39 -0
  61. package/dist/bin/bundler/client/watch.d.ts +13 -0
  62. package/dist/bin/bundler/client/watch.js +71 -0
  63. package/dist/bin/bundler/config/loadEnv.d.ts +20 -0
  64. package/dist/bin/bundler/config/loadEnv.js +48 -0
  65. package/dist/bin/bundler/config/output.d.ts +1 -1
  66. package/dist/bin/bundler/config/output.js +13 -12
  67. package/dist/bin/bundler/externalResolver-dep.d.ts +3 -0
  68. package/dist/bin/bundler/externalResolver-dep.js +203 -0
  69. package/dist/bin/bundler/externalResolver.d.ts +3 -0
  70. package/dist/bin/bundler/externalResolver.js +203 -0
  71. package/dist/bin/bundler/plugins/TransformServer/TransformExpress.d.ts +9 -0
  72. package/dist/bin/bundler/plugins/TransformServer/TransformExpress.js +26 -0
  73. package/dist/bin/bundler/plugins/TransformServer/TransformPage.d.ts +25 -0
  74. package/dist/bin/bundler/plugins/TransformServer/TransformPage.js +79 -0
  75. package/dist/bin/bundler/plugins/TransformServer/index.d.ts +3 -0
  76. package/dist/bin/bundler/plugins/TransformServer/index.js +103 -0
  77. package/dist/bin/bundler/plugins/XanixAssets.d.ts +5 -0
  78. package/dist/bin/bundler/plugins/XanixAssets.js +51 -0
  79. package/dist/bin/bundler/plugins/XanixCacheDeps-dep.d.ts +2 -0
  80. package/dist/bin/bundler/plugins/XanixCacheDeps-dep.js +150 -0
  81. package/dist/bin/bundler/plugins/XanixCacheDeps.d.ts +2 -0
  82. package/dist/bin/bundler/plugins/XanixCacheDeps.js +150 -0
  83. package/dist/bin/bundler/plugins/XanixDocument/index.d.ts +1 -1
  84. package/dist/bin/bundler/plugins/XanixDocument/index.js +24 -14
  85. package/dist/bin/bundler/plugins/XanixEntryFinder/finder.js +0 -6
  86. package/dist/bin/bundler/plugins/XanixEntryFinder-dep/finder.d.ts +11 -0
  87. package/dist/bin/bundler/plugins/XanixEntryFinder-dep/finder.js +149 -0
  88. package/dist/bin/bundler/plugins/XanixEntryFinder-dep/index.d.ts +6 -0
  89. package/dist/bin/bundler/plugins/XanixEntryFinder-dep/index.js +37 -0
  90. package/dist/bin/bundler/plugins/XanixPageTransform/index.d.ts +1 -1
  91. package/dist/bin/bundler/plugins/XanixPageTransform/index.js +48 -33
  92. package/dist/bin/bundler/plugins/XanixPageTransform/transformer copy.d.ts +18 -0
  93. package/dist/bin/bundler/plugins/XanixPageTransform/transformer copy.js +414 -0
  94. package/dist/bin/bundler/plugins/XanixPageTransform/transformer.d.ts +9 -4
  95. package/dist/bin/bundler/plugins/XanixPageTransform/transformer.js +477 -302
  96. package/dist/bin/bundler/plugins/XanixReactRefresh copy.d.ts +2 -0
  97. package/dist/bin/bundler/plugins/XanixReactRefresh copy.js +121 -0
  98. package/dist/bin/bundler/plugins/XanixReactRefresh.d.ts +2 -2
  99. package/dist/bin/bundler/plugins/XanixReactRefresh.js +150 -101
  100. package/dist/bin/bundler/plugins/XanixResolveCacheDeps/BuildClientCache.d.ts +11 -0
  101. package/dist/bin/bundler/plugins/XanixResolveCacheDeps/BuildClientCache.js +129 -0
  102. package/dist/bin/bundler/plugins/XanixResolveCacheDeps/index copy.d.ts +15 -0
  103. package/dist/bin/bundler/plugins/XanixResolveCacheDeps/index copy.js +228 -0
  104. package/dist/bin/bundler/plugins/XanixResolveCacheDeps/index.d.ts +7 -5
  105. package/dist/bin/bundler/plugins/XanixResolveCacheDeps/index.js +156 -21
  106. package/dist/bin/bundler/plugins/XanixResolveCacheDeps-dep/BuildClientCache.d.ts +11 -0
  107. package/dist/bin/bundler/{cacheNpmModules.js → plugins/XanixResolveCacheDeps-dep/BuildClientCache.js} +13 -9
  108. package/dist/bin/bundler/plugins/XanixResolveCacheDeps-dep/index.d.ts +5 -0
  109. package/dist/bin/bundler/plugins/XanixResolveCacheDeps-dep/index.js +26 -0
  110. package/dist/bin/bundler/plugins/XanixResolver.d.ts +11 -0
  111. package/dist/bin/bundler/plugins/XanixResolver.js +55 -0
  112. package/dist/bin/bundler/plugins/XanixServerTransform.d.ts +1 -1
  113. package/dist/bin/bundler/plugins/XanixServerTransform.js +193 -116
  114. package/dist/bin/bundler/plugins/XanixTransform.d.ts +3 -0
  115. package/dist/bin/bundler/plugins/XanixTransform.js +23 -0
  116. package/dist/bin/bundler/plugins/XanixTsconfigAlias.d.ts +1 -1
  117. package/dist/bin/bundler/plugins/XanixUseServer.d.ts +1 -1
  118. package/dist/bin/bundler/plugins/XanixUseServer.js +308 -245
  119. package/dist/bin/bundler/plugins/plugins.d.ts +1 -5
  120. package/dist/bin/bundler/plugins/plugins.js +9 -154
  121. package/dist/bin/bundler/requireCache.d.ts +3 -0
  122. package/dist/bin/bundler/requireCache.js +85 -0
  123. package/dist/bin/bundler/server/build.d.ts +6 -0
  124. package/dist/bin/bundler/server/build.js +92 -0
  125. package/dist/bin/bundler/server/plugins/ServerAction.d.ts +3 -0
  126. package/dist/bin/bundler/server/plugins/ServerAction.js +9 -0
  127. package/dist/bin/bundler/server/plugins/Transformer/ServerAction.d.ts +11 -0
  128. package/dist/bin/bundler/server/plugins/Transformer/ServerAction.js +28 -0
  129. package/dist/bin/bundler/server/plugins/Transformer/TransformCache.d.ts +15 -0
  130. package/dist/bin/bundler/server/plugins/Transformer/TransformCache.js +39 -0
  131. package/dist/bin/bundler/server/plugins/Transformer/TransformCacheFunction.d.ts +3 -0
  132. package/dist/bin/bundler/server/plugins/Transformer/TransformCacheFunction.js +32 -0
  133. package/dist/bin/bundler/server/plugins/Transformer/TransformCreateSession.d.ts +3 -0
  134. package/dist/bin/bundler/server/plugins/Transformer/TransformCreateSession.js +30 -0
  135. package/dist/bin/bundler/server/plugins/Transformer/TransformExpress copy.d.ts +11 -0
  136. package/dist/bin/bundler/server/plugins/Transformer/TransformExpress copy.js +22 -0
  137. package/dist/bin/bundler/server/plugins/Transformer/TransformExpress.d.ts +10 -0
  138. package/dist/bin/bundler/server/plugins/Transformer/TransformExpress.js +19 -0
  139. package/dist/bin/bundler/server/plugins/Transformer/TransformExpressFunction.d.ts +3 -0
  140. package/dist/bin/bundler/server/plugins/Transformer/TransformExpressFunction.js +24 -0
  141. package/dist/bin/bundler/server/plugins/Transformer/TransformPage.d.ts +4 -0
  142. package/dist/bin/bundler/server/plugins/Transformer/TransformPage.js +31 -0
  143. package/dist/bin/bundler/server/plugins/Transformer/TransformReactContext.d.ts +17 -0
  144. package/dist/bin/bundler/server/plugins/Transformer/TransformReactContext.js +101 -0
  145. package/dist/bin/bundler/server/plugins/Transformer/TransformServer.d.ts +10 -0
  146. package/dist/bin/bundler/server/plugins/Transformer/TransformServer.js +19 -0
  147. package/dist/bin/bundler/server/plugins/Transformer/TransformServerAction copy.d.ts +14 -0
  148. package/dist/bin/bundler/server/plugins/Transformer/TransformServerAction copy.js +38 -0
  149. package/dist/bin/bundler/server/plugins/Transformer/TransformServerAction.d.ts +15 -0
  150. package/dist/bin/bundler/server/plugins/Transformer/TransformServerAction.js +44 -0
  151. package/dist/bin/bundler/server/plugins/Transformer/TransformServerFunction.d.ts +3 -0
  152. package/dist/bin/bundler/server/plugins/Transformer/TransformServerFunction.js +32 -0
  153. package/dist/bin/bundler/server/plugins/Transformer/TransformUseServer.d.ts +3 -0
  154. package/dist/bin/bundler/server/plugins/Transformer/TransformUseServer.js +31 -0
  155. package/dist/bin/bundler/server/plugins/Transformer copy.d.ts +6 -0
  156. package/dist/bin/bundler/server/plugins/Transformer copy.js +99 -0
  157. package/dist/bin/bundler/server/plugins/Transformer.d.ts +7 -0
  158. package/dist/bin/bundler/server/plugins/Transformer.js +58 -0
  159. package/dist/bin/bundler/server/plugins/replacer/cacheFunctionReplacer.d.ts +3 -0
  160. package/dist/bin/bundler/server/plugins/replacer/cacheFunctionReplacer.js +28 -0
  161. package/dist/bin/bundler/server/plugins/replacer/expressFunctionReplace.d.ts +3 -0
  162. package/dist/bin/bundler/server/plugins/replacer/expressFunctionReplace.js +24 -0
  163. package/dist/bin/bundler/server/plugins/replacer/pageReplacer.d.ts +4 -0
  164. package/dist/bin/bundler/server/plugins/replacer/pageReplacer.js +31 -0
  165. package/dist/bin/bundler/server/plugins/replacer/serverFunctionReplacer.d.ts +3 -0
  166. package/dist/bin/bundler/server/plugins/replacer/serverFunctionReplacer.js +28 -0
  167. package/dist/bin/bundler/server/plugins/replacer/useServerReplacer.d.ts +3 -0
  168. package/dist/bin/bundler/server/plugins/replacer/useServerReplacer.js +38 -0
  169. package/dist/bin/bundler/server/types.d.ts +5 -0
  170. package/dist/bin/bundler/server/types.js +1 -0
  171. package/dist/bin/bundler/server/watch.config.d.ts +3 -0
  172. package/dist/bin/bundler/server/watch.config.js +71 -0
  173. package/dist/bin/bundler/server/watch.d.ts +9 -0
  174. package/dist/bin/bundler/server/watch.js +59 -0
  175. package/dist/bin/bundler/watchClient.d.ts +5 -3
  176. package/dist/bin/bundler/watchClient.js +31 -16
  177. package/dist/bin/bundler/watchServer.d.ts +2 -2
  178. package/dist/bin/bundler/watchServer.js +66 -12
  179. package/dist/bin/cli/build.js +29 -13
  180. package/dist/bin/cli/create.d.ts +2 -0
  181. package/dist/bin/cli/create.js +2 -0
  182. package/dist/bin/cli/dev/dev.d.ts +2 -0
  183. package/dist/bin/cli/dev/dev.js +178 -0
  184. package/dist/bin/cli/dev/index.d.ts +2 -0
  185. package/dist/bin/cli/dev/index.js +114 -0
  186. package/dist/bin/cli/dev/server.d.ts +1 -0
  187. package/dist/bin/cli/dev/server.js +95 -0
  188. package/dist/bin/cli/dev/ws.d.ts +2 -0
  189. package/dist/bin/cli/dev/ws.js +29 -0
  190. package/dist/bin/cli/dev.js +120 -76
  191. package/dist/bin/cli/logs.d.ts +2 -0
  192. package/dist/bin/cli/logs.js +224 -0
  193. package/dist/bin/cli/restart.d.ts +2 -0
  194. package/dist/bin/cli/restart.js +28 -0
  195. package/dist/bin/cli/resurrect.d.ts +2 -0
  196. package/dist/bin/cli/resurrect.js +79 -0
  197. package/dist/bin/cli/save.d.ts +2 -0
  198. package/dist/bin/cli/save.js +87 -0
  199. package/dist/bin/cli/start/external.d.ts +2 -0
  200. package/dist/bin/cli/start/external.js +22 -0
  201. package/dist/bin/cli/start/index.d.ts +2 -0
  202. package/dist/bin/cli/start/index.js +27 -0
  203. package/dist/bin/cli/start/start.d.ts +2 -0
  204. package/dist/bin/cli/start/start.js +27 -0
  205. package/dist/bin/cli/start.js +10 -17
  206. package/dist/bin/cli/startup.d.ts +2 -0
  207. package/dist/bin/cli/startup.js +170 -0
  208. package/dist/bin/cli/status.d.ts +2 -0
  209. package/dist/bin/cli/status.js +23 -0
  210. package/dist/bin/cli/stop.d.ts +4 -0
  211. package/dist/bin/cli/stop.js +83 -0
  212. package/dist/bin/include/callbackReplacer.d.ts +2 -0
  213. package/dist/bin/include/callbackReplacer.js +91 -0
  214. package/dist/bin/include/importFinder.d.ts +9 -0
  215. package/dist/bin/include/importFinder.js +69 -0
  216. package/dist/bin/include/loadEnv.d.ts +19 -0
  217. package/dist/bin/include/loadEnv.js +47 -0
  218. package/dist/bin/include/manifest.d.ts +2 -3
  219. package/dist/bin/include/manifest.js +7 -23
  220. package/dist/bin/include/path.d.ts +1 -0
  221. package/dist/bin/include/path.js +4 -0
  222. package/dist/bin/include/process.d.ts +12 -0
  223. package/dist/bin/include/process.js +39 -0
  224. package/dist/bin/include/sendFinder.d.ts +6 -0
  225. package/dist/bin/include/sendFinder.js +100 -0
  226. package/dist/bin/include/utils.d.ts +3 -4
  227. package/dist/bin/include/utils.js +10 -12
  228. package/dist/bin/index.js +1 -1
  229. package/dist/bin/modifier/callbackReplacer.d.ts +2 -0
  230. package/dist/bin/modifier/callbackReplacer.js +97 -0
  231. package/dist/bin/modifier/importFinder.d.ts +9 -0
  232. package/dist/bin/modifier/importFinder.js +69 -0
  233. package/dist/bin/modifier/pageFinder.d.ts +9 -0
  234. package/dist/bin/modifier/pageFinder.js +135 -0
  235. package/dist/bin/modifier/sriptCommnet.d.ts +2 -0
  236. package/dist/bin/modifier/sriptCommnet.js +8 -0
  237. package/dist/bin/plugins/XanixAssets.d.ts +6 -0
  238. package/dist/bin/plugins/XanixAssets.js +43 -0
  239. package/dist/bin/plugins/XanixCss.d.ts +5 -0
  240. package/dist/bin/plugins/XanixCss.js +57 -0
  241. package/dist/bin/plugins/XanixDocument/XanixDocument.d.ts +2 -0
  242. package/dist/bin/plugins/XanixDocument/XanixDocument.js +50 -0
  243. package/dist/bin/plugins/XanixDocument/index.d.ts +2 -0
  244. package/dist/bin/plugins/XanixDocument/index.js +50 -0
  245. package/dist/bin/plugins/XanixDocument.d.ts +2 -0
  246. package/dist/bin/plugins/XanixDocument.js +39 -0
  247. package/dist/bin/plugins/XanixPageTransform-dep/index.d.ts +2 -0
  248. package/dist/bin/plugins/XanixPageTransform-dep/index.js +62 -0
  249. package/dist/bin/plugins/XanixPageTransform-dep/transformer.d.ts +23 -0
  250. package/dist/bin/plugins/XanixPageTransform-dep/transformer.js +589 -0
  251. package/dist/bin/plugins/XanixServerTransform.d.ts +5 -0
  252. package/dist/bin/plugins/XanixServerTransform.js +207 -0
  253. package/dist/bin/plugins/XanixTsconfigAlias.d.ts +19 -0
  254. package/dist/bin/plugins/XanixTsconfigAlias.js +197 -0
  255. package/dist/bin/plugins/XanixUseServer.d.ts +7 -0
  256. package/dist/bin/plugins/XanixUseServer.js +445 -0
  257. package/dist/bin/plugins/plugins.d.ts +8 -0
  258. package/dist/bin/plugins/plugins.js +31 -0
  259. package/dist/bin/types.d.ts +2 -8
  260. package/dist/client-runtime.d.ts +0 -8
  261. package/dist/client-runtime.js +45 -103
  262. package/dist/components/BaseDocument.d.ts +1 -1
  263. package/dist/components/BaseDocument.js +2 -2
  264. package/dist/components/Body.d.ts +3 -4
  265. package/dist/components/Body.js +4 -3
  266. package/dist/components/Document.d.ts +3 -4
  267. package/dist/components/Document.js +3 -4
  268. package/dist/components/DocumentContext.d.ts +5 -3
  269. package/dist/components/Head.d.ts +3 -2
  270. package/dist/components/Head.js +17 -10
  271. package/dist/components/Link.d.ts +2 -2
  272. package/dist/components/Link.js +14 -26
  273. package/dist/dev.d.ts +1 -0
  274. package/dist/dev.js +25 -0
  275. package/dist/hooks/cache.d.ts +19 -0
  276. package/dist/hooks/cache.js +53 -0
  277. package/dist/hooks/encript.d.ts +2 -0
  278. package/dist/hooks/encript.js +30 -0
  279. package/dist/hooks/server.d.ts +11 -0
  280. package/dist/hooks/server.js +129 -0
  281. package/dist/hooks/session.d.ts +18 -0
  282. package/dist/hooks/session.js +145 -0
  283. package/dist/hooks/useCookies.d.ts +1 -0
  284. package/dist/hooks/useCookies.js +9 -40
  285. package/dist/hooks/usePage.d.ts +2 -2
  286. package/dist/hooks/usePage.js +2 -5
  287. package/dist/hooks/useSearchParams.js +30 -88
  288. package/dist/hooks/useServer.d.ts +20 -0
  289. package/dist/hooks/useServer.js +91 -0
  290. package/dist/hooks/useStore.d.ts +13 -0
  291. package/dist/hooks/useStore.js +45 -0
  292. package/dist/index.d.ts +19 -6
  293. package/dist/index.js +11 -7
  294. package/dist/navigate.d.ts +4 -6
  295. package/dist/navigate.js +109 -17
  296. package/dist/outdirs.d.ts +1 -1
  297. package/dist/outdirs.js +2 -2
  298. package/dist/react/createContext.d.ts +3 -0
  299. package/dist/react/createContext.js +11 -0
  300. package/dist/react/index.d.ts +12 -0
  301. package/dist/react/index.js +3 -0
  302. package/dist/server/express/Router.d.ts +2 -0
  303. package/dist/server/express/Router.js +115 -0
  304. package/dist/server/express/Ruter.d.ts +2 -0
  305. package/dist/server/express/Ruter.js +15 -0
  306. package/dist/server/express/index.d.ts +3 -0
  307. package/dist/server/express/index.js +90 -0
  308. package/dist/server/express/page.d.ts +10 -0
  309. package/dist/server/express/page.js +133 -0
  310. package/dist/server/index.d.ts +19 -0
  311. package/dist/server/index.js +44 -1
  312. package/dist/server/runtime/createServer.js +2 -0
  313. package/dist/server/runtime/readManifest.js +1 -1
  314. package/dist/server/runtime/xanixPage.js +9 -15
  315. package/dist/server/types.d.ts +52 -0
  316. package/dist/server/types.js +1 -0
  317. package/dist/types/assets.d.ts +72 -34
  318. package/dist/types/express.d.ts +11 -7
  319. package/dist/types/globals.d.ts +18 -26
  320. package/dist/types/xanix-virtual.d.ts +35 -41
  321. package/package.json +60 -72
  322. package/dist/bin/bundler/cacheNpmModules.d.ts +0 -11
  323. package/dist/bin/bundler/dep-generateClientEntries.d.ts +0 -5
  324. package/dist/bin/bundler/dep-generateClientEntries.js +0 -25
  325. package/dist/bin/bundler/generateClientEntries.d.ts +0 -5
  326. package/dist/bin/bundler/generateClientEntries.js +0 -25
  327. package/dist/bin/bundler/plugins/xanixUseDataId.d.ts +0 -4
  328. package/dist/bin/bundler/plugins/xanixUseDataId.js +0 -93
  329. package/dist/bin/cli/browser.d.ts +0 -1
  330. package/dist/bin/cli/browser.js +0 -97
  331. package/dist/dataLoader.d.ts +0 -11
  332. package/dist/dataLoader.js +0 -52
  333. package/dist/hooks/useData.d.ts +0 -14
  334. package/dist/hooks/useData.js +0 -68
  335. package/dist/hooks/useRequest copy.d.ts +0 -2
  336. package/dist/hooks/useRequest copy.js +0 -8
  337. package/dist/hooks/useServer/core.d.ts +0 -20
  338. package/dist/hooks/useServer/core.js +0 -72
  339. package/dist/hooks/useServer/index.d.ts +0 -20
  340. package/dist/hooks/useServer/index.js +0 -76
  341. package/dist/hooks/useServer/registry.d.ts +0 -0
  342. package/dist/hooks/useServer/registry.js +0 -1
  343. package/dist/hooks/useServer/resource.d.ts +0 -11
  344. package/dist/hooks/useServer/resource.js +0 -49
  345. package/dist/hooks/useServer/state.d.ts +0 -9
  346. package/dist/hooks/useServer/state.js +0 -33
  347. package/dist/theme.d.ts +0 -3
  348. package/dist/theme.js +0 -10
  349. /package/dist/bin/{browser.d.ts → cli/start/utils.d.ts} +0 -0
  350. /package/dist/bin/{browser.js → cli/start/utils.js} +0 -0
@@ -0,0 +1,6 @@
1
+ export type AppRootProps = {
2
+ Component: any;
3
+ doc: any;
4
+ };
5
+ declare const AppRoot: ({ Component, doc }: AppRootProps) => import("react").JSX.Element;
6
+ export default AppRoot;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import pages from "virtual:xanix-pages";
3
+ import Document from "virtual:xanix-document";
4
+ import { useState, useEffect } from "react";
5
+ import { DocumentProvider } from "./components/DocumentContext";
6
+ import xanix from "./server/index.js";
7
+ const AppRoot = ({ Component, doc }) => {
8
+ const [_document, setDocument] = useState(doc);
9
+ useEffect(() => {
10
+ xanix.on("navigate:end", setDocument);
11
+ }, []);
12
+ const ComponentToRender = pages[_document.page.id] || Component;
13
+ return (_jsx(DocumentProvider, { value: _document, children: _jsx(Document, { children: _jsx(ComponentToRender, {}) }) }));
14
+ };
15
+ export default AppRoot;
@@ -0,0 +1 @@
1
+ export declare function Caching(): Promise<void>;
@@ -0,0 +1,210 @@
1
+ import path from "node:path";
2
+ import fs from "node:fs";
3
+ import { rolldown, watch } from "rolldown";
4
+ const root = process.cwd();
5
+ const appEntry = path.resolve(root, "src/index.ts");
6
+ const outDir = path.resolve(root, ".xanix");
7
+ const cacheDir = path.join(outDir, "cache");
8
+ function normalize(id) {
9
+ return id.replace(/\\/g, "/");
10
+ }
11
+ function isNodeModule(id) {
12
+ return normalize(id).includes("/node_modules/");
13
+ }
14
+ function getPackageName(id) {
15
+ const normalized = normalize(id);
16
+ const match = normalized.match(/\/node_modules\/((?:@[^/]+\/)?[^/]+)/);
17
+ if (!match) {
18
+ return null;
19
+ }
20
+ return match[1];
21
+ }
22
+ function getSafeEntryName(packageName) {
23
+ return packageName
24
+ .replace(/^@/, "")
25
+ .replace(/\//g, "-")
26
+ .replace(/[^a-zA-Z0-9._-]/g, "-");
27
+ }
28
+ /**
29
+ * Finds the package root from a node_modules file.
30
+ */
31
+ function getPackageRoot(id) {
32
+ const normalized = normalize(id);
33
+ const index = normalized.lastIndexOf("/node_modules/");
34
+ if (index === -1) {
35
+ return null;
36
+ }
37
+ const after = normalized.slice(index + "/node_modules/".length);
38
+ const parts = after.split("/");
39
+ if (parts[0].startsWith("@")) {
40
+ if (!parts[1]) {
41
+ return null;
42
+ }
43
+ return path.join(normalized.slice(0, index), "node_modules", parts[0], parts[1]);
44
+ }
45
+ return path.join(normalized.slice(0, index), "node_modules", parts[0]);
46
+ }
47
+ /**
48
+ * Plugin used only to discover node_modules dependencies.
49
+ */
50
+ function discoverDependencies() {
51
+ const dependencies = new Map();
52
+ const plugin = {
53
+ name: "xanix-discover-dependencies",
54
+ resolveId(source, importer) {
55
+ if (!importer) {
56
+ return null;
57
+ }
58
+ return null;
59
+ },
60
+ load(id) {
61
+ if (!isNodeModule(id)) {
62
+ return null;
63
+ }
64
+ const packageName = getPackageName(id);
65
+ if (!packageName) {
66
+ return null;
67
+ }
68
+ if (!dependencies.has(packageName)) {
69
+ dependencies.set(packageName, id);
70
+ }
71
+ return null;
72
+ },
73
+ };
74
+ return {
75
+ plugin,
76
+ dependencies,
77
+ };
78
+ }
79
+ /**
80
+ * Build the input object dynamically.
81
+ *
82
+ * IMPORTANT:
83
+ *
84
+ * The dependencies need to become independent entries.
85
+ */
86
+ async function createInputs() {
87
+ const discovered = new Map();
88
+ const plugin = {
89
+ name: "xanix-discover",
90
+ resolveId(source, importer) {
91
+ return null;
92
+ },
93
+ load(id) {
94
+ if (!isNodeModule(id)) {
95
+ return null;
96
+ }
97
+ const packageName = getPackageName(id);
98
+ if (packageName) {
99
+ discovered.set(packageName, id);
100
+ }
101
+ return null;
102
+ },
103
+ };
104
+ /*
105
+ * First build only to discover the dependency graph.
106
+ */
107
+ const discoveryBundle = await rolldown({
108
+ input: appEntry,
109
+ plugins: [plugin],
110
+ });
111
+ await discoveryBundle.generate({
112
+ format: "esm",
113
+ });
114
+ /*
115
+ * Add the application entry.
116
+ */
117
+ const inputs = {
118
+ app: appEntry,
119
+ };
120
+ /*
121
+ * Add each discovered npm package as an independent entry.
122
+ */
123
+ for (const [packageName, id] of discovered) {
124
+ const entryName = getSafeEntryName(packageName);
125
+ inputs[`dep_${entryName}`] = id;
126
+ }
127
+ return inputs;
128
+ }
129
+ /**
130
+ * Cache plugin.
131
+ *
132
+ * This does NOT rebuild the dependencies separately.
133
+ *
134
+ * They are entries in the SAME Rolldown watch.
135
+ */
136
+ function xanixCachePlugin() {
137
+ return {
138
+ name: "xanix-cache",
139
+ outputOptions(options) {
140
+ return {
141
+ ...options,
142
+ entryFileNames(chunk) {
143
+ if (chunk.name.startsWith("dep_")) {
144
+ const name = chunk.name.slice("dep_".length);
145
+ return `cache/${name}.js`;
146
+ }
147
+ return "[name].js";
148
+ },
149
+ };
150
+ },
151
+ };
152
+ }
153
+ export async function Caching() {
154
+ fs.mkdirSync(cacheDir, {
155
+ recursive: true,
156
+ });
157
+ /*
158
+ * Discover dependencies once when creating the watch graph.
159
+ */
160
+ const inputs = await createInputs();
161
+ console.log("Rolldown watch entries:");
162
+ for (const [name, value] of Object.entries(inputs)) {
163
+ console.log(` ${name} → ${value}`);
164
+ }
165
+ /*
166
+ * ONE Rolldown watch.
167
+ *
168
+ * No buildDependencyCache().
169
+ * No external dependency build.
170
+ */
171
+ const watcher = await watch({
172
+ input: inputs,
173
+ plugins: [xanixCachePlugin()],
174
+ output: {
175
+ dir: outDir,
176
+ format: "esm",
177
+ entryFileNames: (chunk) => {
178
+ if (chunk.name.startsWith("dep_")) {
179
+ const name = chunk.name.slice("dep_".length);
180
+ return `cache/${name}.js`;
181
+ }
182
+ return "[name].js";
183
+ },
184
+ chunkFileNames: "chunks/[name]-[hash].js",
185
+ assetFileNames: "assets/[name]-[hash][extname]",
186
+ },
187
+ watch: {
188
+ include: ["src/**", "node_modules/**"],
189
+ },
190
+ });
191
+ watcher.on("event", (event) => {
192
+ switch (event.code) {
193
+ case "START":
194
+ console.log("watch started");
195
+ break;
196
+ case "BUNDLE_START":
197
+ console.log("building...");
198
+ break;
199
+ case "BUNDLE_END":
200
+ console.log(`built in ${event.duration}ms`);
201
+ break;
202
+ case "END":
203
+ console.log("waiting for changes...");
204
+ break;
205
+ case "ERROR":
206
+ console.error(event.error);
207
+ break;
208
+ }
209
+ });
210
+ }
@@ -0,0 +1,3 @@
1
+ import { Plugin } from "rollup";
2
+ declare const external: () => Plugin;
3
+ export default external;
@@ -0,0 +1,6 @@
1
+ const external = () => {
2
+ return {
3
+ name: "external",
4
+ };
5
+ };
6
+ export default external;
@@ -1,4 +1,4 @@
1
- import { rollup } from "rollup";
1
+ import { rolldown } from "rolldown";
2
2
  import fs from "node:fs";
3
3
  import bundlerOutput from "./config/output.js";
4
4
  import { getClientRuntimeFile, getClientRuntimeFileName, } from "../include/utils.js";
@@ -18,7 +18,7 @@ const buildClient = async (entries) => {
18
18
  fs.mkdirSync(outdirs.client, {
19
19
  recursive: true,
20
20
  });
21
- const build = await rollup({
21
+ const build = await rolldown({
22
22
  input,
23
23
  treeshake: true,
24
24
  onwarn(warning, warn) {
@@ -1,4 +1,4 @@
1
- import { rollup } from "rollup";
1
+ import { rolldown } from "rolldown";
2
2
  import path from "node:path";
3
3
  import bundlerOutput from "./config/output.js";
4
4
  import fs from "node:fs";
@@ -18,7 +18,7 @@ const BuildServer = async ({ rootEntry, onBuildEnd }) => {
18
18
  const input = {
19
19
  index: path.resolve(root, rootEntry),
20
20
  };
21
- const build = await rollup({
21
+ const build = await rolldown({
22
22
  input,
23
23
  treeshake: true,
24
24
  onwarn(warning, warn) {
@@ -0,0 +1,3 @@
1
+ import type { CachedModule } from "./types.js";
2
+ declare const buildCache: (cached: Map<string, CachedModule>) => Promise<void>;
3
+ export default buildCache;
@@ -0,0 +1,76 @@
1
+ import { rolldown } from "rolldown";
2
+ import loadEnv from "../../include/loadEnv.js";
3
+ import outdirs from "../../../outdirs.js";
4
+ const VIRTUAL_PREFIX = "\0xanix-cache:";
5
+ const buildCache = async (cached) => {
6
+ const input = {};
7
+ for (const [source, { name }] of cached) {
8
+ input[name] = `${VIRTUAL_PREFIX}${name}`;
9
+ }
10
+ const build = await rolldown({
11
+ input,
12
+ treeshake: true,
13
+ platform: "browser",
14
+ tsconfig: true,
15
+ checks: {
16
+ moduleLevelDirective: false,
17
+ },
18
+ resolve: {
19
+ extensions: [".mjs", ".js", ".jsx", ".json", ".ts", ".tsx"],
20
+ conditionNames: ["browser", "import", "module", "default"],
21
+ },
22
+ transform: {
23
+ target: "es2020",
24
+ jsx: {
25
+ runtime: "automatic",
26
+ },
27
+ define: await loadEnv({
28
+ mode: "development",
29
+ isClient: false,
30
+ }),
31
+ },
32
+ plugins: [
33
+ {
34
+ name: "CacheEntry",
35
+ resolveId(source) {
36
+ if (source.startsWith(VIRTUAL_PREFIX)) {
37
+ return source;
38
+ }
39
+ return null;
40
+ },
41
+ load(id) {
42
+ if (!id.startsWith(VIRTUAL_PREFIX)) {
43
+ return null;
44
+ }
45
+ const name = id.slice(VIRTUAL_PREFIX.length);
46
+ const cache = [...cached.values()].find((item) => item.name === name);
47
+ if (!cache) {
48
+ return null;
49
+ }
50
+ const resolved = cache.resolved || cache.module;
51
+ if (cache.default) {
52
+ return `
53
+ import * as __xanix_namespace from ${JSON.stringify(resolved)};
54
+
55
+ export default __xanix_namespace.default;
56
+ export { __xanix_namespace };
57
+ `;
58
+ }
59
+ return `
60
+ import * as __xanix_namespace from ${JSON.stringify(resolved)};
61
+
62
+ export default __xanix_namespace;
63
+ export { __xanix_namespace };
64
+ `;
65
+ },
66
+ },
67
+ ],
68
+ });
69
+ await build.write({
70
+ dir: outdirs.module_cache,
71
+ format: "es",
72
+ entryFileNames: "[name].js",
73
+ });
74
+ await build.close();
75
+ };
76
+ export default buildCache;
@@ -0,0 +1,3 @@
1
+ import { Plugin } from "rolldown";
2
+ declare const XanixCache: () => Plugin;
3
+ export default XanixCache;
@@ -0,0 +1,216 @@
1
+ import { createRequire } from "node:module";
2
+ import { isPackageImport, makeFilename } from "./utils.js";
3
+ import buildCache from "./buildCache.js";
4
+ import { walk } from "oxc-walker";
5
+ import { builtinModules } from "node:module";
6
+ import { readManifest, writeManifest } from "./manifest.js";
7
+ import logger from "../../include/logger.js";
8
+ import pc from "picocolors";
9
+ const nodeBuiltins = new Set(builtinModules);
10
+ function isNodeBuiltin(id) {
11
+ const normalized = id.startsWith("node:") ? id.slice(5) : id;
12
+ return nodeBuiltins.has(normalized);
13
+ }
14
+ const require = createRequire(import.meta.url);
15
+ function getParserLanguage(id) {
16
+ const cleanId = id.split("?")[0];
17
+ if (cleanId.endsWith(".tsx"))
18
+ return "tsx";
19
+ if (cleanId.endsWith(".ts"))
20
+ return "ts";
21
+ if (cleanId.endsWith(".jsx"))
22
+ return "jsx";
23
+ return "js";
24
+ }
25
+ function makeImportName(name) {
26
+ return `require_${name.replace(/[^a-zA-Z0-9_$]/g, "_")}`;
27
+ }
28
+ const XanixCache = () => {
29
+ const cached = new Map();
30
+ let init = false;
31
+ return {
32
+ name: "__xmod",
33
+ buildStart() {
34
+ cached.clear();
35
+ },
36
+ watchChange() {
37
+ cached.clear();
38
+ },
39
+ async resolveId(source) {
40
+ if (source.startsWith("/__xmod")) {
41
+ return {
42
+ id: source,
43
+ external: true,
44
+ };
45
+ }
46
+ return null;
47
+ },
48
+ async transform(code, id) {
49
+ if (id.includes("/node_modules/") || id.includes("/.xanix/")) {
50
+ return null;
51
+ }
52
+ if (!code.includes("import ") && !code.includes("import(")) {
53
+ return null;
54
+ }
55
+ const lang = getParserLanguage(id);
56
+ const ast = this.parse(code, { lang });
57
+ const packages = [];
58
+ let replacements = [];
59
+ walk(ast, {
60
+ enter(node) {
61
+ if (node.type !== "ImportDeclaration" || node.importKind === "type") {
62
+ return;
63
+ }
64
+ const source = node.source.value;
65
+ if (typeof source !== "string" ||
66
+ !isPackageImport(source) ||
67
+ isNodeBuiltin(source)) {
68
+ return;
69
+ }
70
+ /*
71
+ * Don't add the same package multiple times
72
+ * when the file imports it more than once.
73
+ */
74
+ if (!packages.includes(source)) {
75
+ packages.push(source);
76
+ }
77
+ const name = makeFilename(source);
78
+ const importName = makeImportName(name);
79
+ const cachePath = `/__xmod/${name}.js`;
80
+ const lines = [];
81
+ const specifiers = (node.specifiers ?? []).filter((specifier) => specifier.importKind !== "type");
82
+ if (!specifiers.length) {
83
+ lines.push(`import "${cachePath}";`);
84
+ }
85
+ else {
86
+ const defaultSpecifier = specifiers.find((specifier) => specifier.type === "ImportDefaultSpecifier");
87
+ const namespaceSpecifier = specifiers.find((specifier) => specifier.type === "ImportNamespaceSpecifier");
88
+ const namedSpecifiers = specifiers.filter((specifier) => specifier.type === "ImportSpecifier");
89
+ /*
90
+ * Only import default when the original import
91
+ * actually has a default import.
92
+ */
93
+ if (defaultSpecifier) {
94
+ lines.push(`import ${importName} from "${cachePath}";`);
95
+ lines.push(`const ${defaultSpecifier.local.name} = ${importName};`);
96
+ }
97
+ /*
98
+ * Namespace and named imports use the Xanix
99
+ * namespace export.
100
+ */
101
+ if (namespaceSpecifier || namedSpecifiers.length) {
102
+ const namespaceName = `${importName}_ns`;
103
+ lines.push(`import { __xanix_namespace as ${namespaceName} } from "${cachePath}";`);
104
+ if (namespaceSpecifier) {
105
+ lines.push(`const ${namespaceSpecifier.local.name} = ${namespaceName};`);
106
+ }
107
+ if (namedSpecifiers.length) {
108
+ const properties = namedSpecifiers
109
+ .map((specifier) => {
110
+ const imported = specifier.imported?.type === "Identifier"
111
+ ? specifier.imported.name
112
+ : specifier.imported?.value;
113
+ const local = specifier.local?.name;
114
+ if (!imported || !local) {
115
+ return null;
116
+ }
117
+ if (imported !== local) {
118
+ if (typeof imported === "string" &&
119
+ !/^[$A-Z_a-z][$\w]*$/.test(imported)) {
120
+ return `${JSON.stringify(imported)}: ${local}`;
121
+ }
122
+ return `${imported}: ${local}`;
123
+ }
124
+ return imported;
125
+ })
126
+ .filter(Boolean)
127
+ .join(", ");
128
+ if (properties) {
129
+ lines.push(`const { ${properties} } = ${namespaceName};`);
130
+ }
131
+ }
132
+ }
133
+ }
134
+ if (!cached.has(source)) {
135
+ cached.set(source, {
136
+ module: source,
137
+ name,
138
+ resolved: "",
139
+ exports: [],
140
+ default: false,
141
+ });
142
+ }
143
+ replacements.push({
144
+ source,
145
+ start: node.start,
146
+ end: node.end,
147
+ value: lines.join("\n"),
148
+ });
149
+ },
150
+ });
151
+ if (!replacements.length) {
152
+ return null;
153
+ }
154
+ /*
155
+ * Resolve ONLY newly discovered packages.
156
+ *
157
+ * Never loop through the entire cache here.
158
+ */
159
+ for (const source of packages) {
160
+ const cache = cached.get(source);
161
+ if (!cache || cache.resolved)
162
+ continue;
163
+ try {
164
+ const resolved = await this.resolve(source, id);
165
+ if (!resolved?.id || !resolved.id.includes("node_modules")) {
166
+ throw new Error(`Resolved module ${resolved.id} is not in node_modules`);
167
+ }
168
+ cache.resolved = resolved.id;
169
+ const mod = require(resolved.id);
170
+ cache.exports = Object.keys(mod);
171
+ cache.default = Object.prototype.hasOwnProperty.call(mod, "default");
172
+ }
173
+ catch (error) {
174
+ cached.delete(source);
175
+ }
176
+ }
177
+ for (let rep of replacements) {
178
+ const cache = cached.get(rep.source);
179
+ if (!cache ||
180
+ !cache.resolved ||
181
+ !cache.resolved.includes("node_modules")) {
182
+ replacements = replacements.filter((r) => r.source !== rep.source);
183
+ }
184
+ }
185
+ /*
186
+ * Apply replacements only when this file actually
187
+ * contained cacheable imports.
188
+ */
189
+ const sorted = replacements.sort((a, b) => b.start - a.start);
190
+ for (const { start, end, value } of sorted) {
191
+ code = code.slice(0, start) + value + code.slice(end);
192
+ }
193
+ return {
194
+ code,
195
+ map: null,
196
+ };
197
+ },
198
+ async generateBundle() {
199
+ // write manifest
200
+ const cachedManifest = await readManifest();
201
+ const pmodules = Array.from(cachedManifest.values()).map((m) => m.module);
202
+ const cmodule = Array.from(cached.values()).map((m) => m.module);
203
+ const hasChanges = pmodules.some((m) => !cmodule.includes(m)) ||
204
+ cmodule.some((m) => !pmodules.includes(m));
205
+ if (hasChanges) {
206
+ if (init) {
207
+ logger.info(`${pc.yellow("Optimizing dependencies")} `, "[optimize]");
208
+ }
209
+ init = true;
210
+ await buildCache(cached);
211
+ await writeManifest(cached);
212
+ }
213
+ },
214
+ };
215
+ };
216
+ export default XanixCache;
@@ -0,0 +1,3 @@
1
+ import type { CachedMap } from "./types.js";
2
+ export declare const writeManifest: (manifest: CachedMap) => Promise<void>;
3
+ export declare const readManifest: () => Promise<CachedMap>;
@@ -0,0 +1,27 @@
1
+ import fs from "fs/promises";
2
+ import outdirs from "../../../outdirs.js";
3
+ const manifestFile = `${outdirs.module_cache}/manifest.json`;
4
+ export const writeManifest = async (manifest) => {
5
+ const data = Array.from(manifest.values());
6
+ for (const item of data) {
7
+ delete item.exports;
8
+ delete item.default;
9
+ delete item.resolved;
10
+ delete item.name;
11
+ }
12
+ await fs.writeFile(manifestFile, JSON.stringify(data, null, 2), "utf-8");
13
+ };
14
+ export const readManifest = async () => {
15
+ try {
16
+ const content = await fs.readFile(manifestFile, "utf-8");
17
+ const parsed = JSON.parse(content);
18
+ let data = new Map();
19
+ for (let p of parsed) {
20
+ data.set(p.module, p);
21
+ }
22
+ return data;
23
+ }
24
+ catch {
25
+ return new Map();
26
+ }
27
+ };
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from "rolldown";
2
+ declare const CacheExportPlugin: () => Plugin;
3
+ export default CacheExportPlugin;
@@ -0,0 +1,42 @@
1
+ import { createRequire } from "module";
2
+ const require = createRequire(import.meta.url);
3
+ const exportsMap = new Map();
4
+ const CacheExportPlugin = () => {
5
+ return {
6
+ name: "cache-export",
7
+ load(id) {
8
+ if (!id.includes("node_modules")) {
9
+ return null;
10
+ }
11
+ try {
12
+ const mod = require(id);
13
+ const names = Object.keys(mod);
14
+ exportsMap.set(id, names);
15
+ console.log(id, names);
16
+ }
17
+ catch {
18
+ // ignore modules that cannot be require()'d
19
+ }
20
+ return null;
21
+ },
22
+ generateBundle(_options, bundle) {
23
+ for (const output of Object.values(bundle)) {
24
+ if (output.type !== "chunk" || !output.isEntry) {
25
+ continue;
26
+ }
27
+ const id = output.facadeModuleId;
28
+ if (!id) {
29
+ continue;
30
+ }
31
+ const names = exportsMap.get(id);
32
+ if (!names) {
33
+ continue;
34
+ }
35
+ console.log("Generating:", id);
36
+ console.log("Exports:", names);
37
+ // Here you generate your ESM exports.
38
+ }
39
+ },
40
+ };
41
+ };
42
+ export default CacheExportPlugin;
@@ -0,0 +1,8 @@
1
+ export type CachedModule = {
2
+ module: string;
3
+ name: string;
4
+ resolved: string;
5
+ exports: string[];
6
+ default: boolean;
7
+ };
8
+ export type CachedMap = Map<string, CachedModule>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare function isPackageImport(source: string): boolean;
2
+ export declare const makeFilename: (id: string) => string;
3
+ export declare const writeCacheManifest: (cached: Map<string, string>) => Promise<void>;
4
+ export declare const readCacheManifest: () => Promise<Map<any, any>>;
5
+ export declare function isNodeBuiltin(id: string): boolean;