Chat Logs

  1. phalethno flash!
  2. phalethnot even on epiphany
  3. phaleth16 files changed
  4. bluephaleth: hi. how did you do that?
  5. blueI'm working on markdowndb btw
  6. blueI think markdown as a traditional frontend. really makes no sense. it doesn't get props, and it doesn't have logic
  7. blueinstead, we're going to have a store-like interface around it that queries the data in real time in dev, and in prod inlines everything
  8. bluethe inline part is hard, because that possibly requires access to app, and dbs don't partake in the app lifecycle
  9. bluephaleth: dreamreal: https://dpaste.com/3QSFU543W
  10. bluethen on `BlogPost.get("primate-39"), you're gonna get { html, toc, path, body, frontmatter }
  11. bluethe only tricky part is to have this operation loads from the fs in dev, and from memory, as part of the bundle, in prod
  12. blueload*
  13. bluebut markdowndb is the key to unlock full cms capabilities
  14. phalethblue: hi
  15. phalethcan you check the last PR on primate repo?
  16. phalethI'm looking for a post-build handler or something like that
  17. phaleth*latest PR
  18. phalethwhy is it called db if it's not overridable?
  19. blueI'll check it phaleth
  20. bluewhat do you mean with no overridable?
  21. bluenot(
  22. bluenot*
  23. phalethmarkdown files are static I guess
  24. bluethe problem is we want different behaviour during dev and prod. in dev it's acceptable to load / transform the mds on the fly, in prod it isn't
  25. blueplus, primate/website has different addons like transforming snippets which makes everything more complicated
  26. blueI wish I had a good solution for it, I currently don't
  27. phalethso the db is like a cache for md files?
  28. phalethmight was well just transform them to html and let the site be static
  29. phalethbtw, the PR I opened is getting towards that, just need to figure out a build step, I could slap something together after build, but I'm wondering if there is something primate specific
  30. bluethere is `app.done`. I don't like it, but you can use it
  31. bluehttps://github.com/primate-run/primate/blob/master/packages/native/src/private/module.ts#L29
  32. bluethat's essentially a postbuild
  33. bluethe thing is that I want something in between "fully static, separate HTMLs" and "load/transform mds in dev mode"
  34. blueI do like the fact the current solution bundles everything into one server.js
  35. blueforcing you to otherwise always do --target=static could be a regression
  36. blue(or copy the .mds to production and load them on demand)
  37. bluealso we reason about the mds in some routes
  38. bluehttps://github.com/primate-run/primate/blob/master/apps/website/routes/llms.txt.ts
  39. bluehttps://github.com/primate-run/primate/blob/master/apps/website/routes/llms-full.txt.ts
  40. bluethese two would be a catastrophe without caching
  41. phalethcaching server side you mean?
  42. blueyes
  43. blueobviously in a world of --target=static, you just build llms.txt into llms.txt.html once and you're done
  44. phalethjust take a look at the response time here, it's not so bad https://grafana.repopack.app/public-dashboards/ce90d22ed104477ea945d2c35aa8d3d7
  45. blueit's not bad right now because it's all precompiled in memory
  46. phalethif the website gets busy then you can bother yourself with that, but then SSG and running the site on nginx would solve all those problems
  47. phalethyeah, and memory is fast
  48. blueyes but @primate/markdown is just for apps/website, I'm trying to rethink it as a general cms-like solution
  49. blueisn't just*
  50. phalethdid you see the response time? :)
  51. phaleththere is not much to gain
  52. blue9 ms?
  53. phalethyeah, deno is kinda slow, but still acceptable
  54. blueno let's optimise it to 0.5 ms </sumner>
  55. phalethheh, then that means it's nginx
  56. blueyeah I was joking, 9 ms is totally acceptable for now
  57. blueso my point is
  58. blueapps/website is actually not the issue here. it'll get --target=static and be happy with its htmls. especially with your colourscheme work
  59. bluethe issue here are other apps. I have this small apps where I keep notes, like obsidian, and the 'load from fs' is fully acceptable for it at least in dev mode
  60. bluesmall app*
  61. blueso essentially this is a caching problem
  62. blueyou don't want to run the expensive md > html pipeline on every request
  63. blueyou ideally only want to run it when the source has changed
  64. bluefor the fs, you could do a small `stats` check I suppose and compare against what you last saw
  65. phalethok, so then it's a store, it's not a db
  66. blueyes it is a store, it'll be exposed as markdown.store
  67. blueand you'll have programmatic access to the frontmatter and also partitioning
  68. blue(say if you have i18n)
  69. phaleththe github experience https://images4.imagebam.com/6a/e8/8a/ME1D55XF_o.png
  70. blueoh wow, that looks like garbage
  71. blueI think what we need is
  72. phalethyeah
  73. blue@primate/markdown.store becomes the new way to use markdown, and --target=static is how we solve the caching problem for apps/website
  74. blueI still don't know how to tell --target=static though how it should generate pages based on a parameterised route
  75. bluebut yeah, all of this still doesn't solve my major conundrum during dev which is that apps/website takes way too long to start up, and recreate the bundle
  76. phalethyeah, primate website takes a while to startup in dev mode
  77. bluemaybe, markdown.store runs all the pipeline on startup (or if you don't care, you can pass in lazy: true).
  78. bluein dev mode I'd generally go lazy, I think
  79. blueand the website would start up immediately
  80. blueso every docs page is converted on the fly, and then cached until stats has changed
  81. blueand in production, --target=static takes over, so laziness isn't relevant, everything gets produced during build
  82. bluemaybe I don't even need lazy: true and it's always lazy, and always cached
  83. blueI think this is a good compromise
  84. bluebut this requires markdown stores and --target=static to arrive in the same commit
  85. blueotherwise we can't meaningfully deploy the website, it'll be slow on first requests and you'd need to copy .md files and the snippets directly and what not
  86. phalethcool, looking forward to static target
  87. blueya
  88. phalethI have a FileRef to a text file, now I need to replace contents inside the file behind the FileRef, how to do that with rcompat?
  89. phalethnpm install replace
  90. phalethomg
  91. phalethwrite method exists
  92. blueyes
  93. blueif it's an object you want to write you also have writeJSON
  94. bluethat will write it out as a JSON string you can later load with #json
  95. phalethit's a JS file
  96. phalethplain text
  97. bluecool, then just #write
  98. phalethwrite works, I just don't know how to read the file
  99. bluetext()
  100. phalethah, ok
  101. bluedo you want to read it, or import it?
  102. phalethnice, that worked
  103. bluecool
  104. phalethblue: any clue why is the browser getting the unminified file? https://images4.imagebam.com/61/fe/8d/ME1D57VH_o.png
  105. phalethI've just pushed the changes, but why is that JS file served unminified and with the correct filename containing the hash is a total mystery
  106. bluephaleth: where is that file located, in static?
  107. blueit looks like esbuild chunked it
  108. blueit should be minified though
  109. blueoh, it's in static
  110. blueare the js/css minified?
  111. phalethyeah, I guess that file being in static dir is the problem, so I'm gonna run it through the bundler even for dev
  112. bluewhat I'm wondering aobut is how come this didn't land in app.js. it should
  113. phalethno, it should not, that's actually the goal
  114. blueoh, ok
  115. blueshould still be minified
  116. phalethit's supposed to be it's own chunk
  117. phalethyeah, everything is minifed, it's just that one file originaly from static dir is served verbatim
  118. bluehow did you achieve chunking?
  119. phalethI'll just make it a ts file and make it part of the build for dev
  120. phalethmagic :D
  121. bluelol
  122. phalethtake a look at app.html on the PR
  123. blueoh
  124. blue<script src="scheme-storage.js"></script>
  125. phalethlooks like I can have a client dir as part of the project
  126. bluehm, I still believe primate scans the static dir for js/css and incorporates it
  127. phalethok, then I should move that to client dir
  128. bluewhat does that client dir do?
  129. blueI'm discovering things about primate I never knew existed :P
  130. bluethat's fairly wonderous, given I've written nearly 100% of it myself, haha
  131. phalethI hope if I put the file in client dir it will end up in build/client
  132. blueI don't know what that hope is based on
  133. blueis that documented?
  134. phalethit's a flat out hope
  135. blueoh
  136. blueprobably not gonna work
  137. phalethI don't tend to look into documentation
  138. blueya
  139. bluesame
  140. bluedocs are for idiots
  141. phalethso what should I use instead of the static dir?
  142. bluewell generally speaking, %head% is your friend
  143. blueyou shouldn't hard-encode scripts into <head>
  144. bluelet me see what's the way to latch onto %head%
  145. blue .replace("%head%", render_head(this.#assets, head));
  146. bluelet's see how #assets is populated
  147. phalethI can get FileRef to app.html
  148. blueok, AppServe#publish does that
  149. phalethbut you know the app.html ends up being in server.js when in the post build phase
  150. phalethnot sure if the %head% thing is still in place there, but let me see
  151. blueya
  152. bluehmpf, I don't see anyone calling publish really
  153. blueis this mechanism even in use anymore
  154. blueI think esbuild completely replaced it
  155. phalethah ok, the %head% is still there
  156. phalethyeah, so that means esbuild has put the scheme-storage-blahblah.js into head and that's why it's served verbatim
  157. phalethbut I need to chunk it out, so how to tell AppServe.publish or whatever to not include that?
  158. blueso I think publish is dead code
  159. bluelook at ServeApp#start
  160. bluethat generates the assets
  161. phalethyeah, but that's in core
  162. blue Object.entries(this.#serve_assets.client)
  163. bluelet me see who populates that
  164. phalethor not? I was hoping there would be a handler I could hook up to from within Website.ts
  165. phalethisn't there onServe?
  166. phalethI think I've deleted that one
  167. bluethere is, yes
  168. phalethI have no clue what to do
  169. bluewhat are you trying to achieve
  170. phalethexactly what's on that picture, but the response for scheme-storage-blahblah.js should be minified as you see in the text editor above
  171. bluepull it into the bundle then
  172. blueplace the file in static, esbuild will pull it in
  173. bluedon't worry about the rest of the stuff
  174. phalethno, the bundle is too big and that's why there is a flash
  175. phaletheven currently, there is a flash
  176. blueyes but in --target=static, the bundle won't contain much
  177. phalethnah, it will always be tens of KBs at least and that's enough to flash
  178. phalethalso this tiny JS is loaded before css
  179. phalethand that huge bundle should not be loaded before css and should not stop css for loading either
  180. bluebut in the future, that bundles should be basically only scheme-storage,js
  181. bluebundle*
  182. phalethbut since there is at least the content hash, I'm fine with what's currently on that PR
  183. blueeverything else falls away, the components, the fetch navigation, etc.
  184. blueyou can simulate it now by turning off CSR
  185. bluesvelte({ csr: false })
  186. phalethwell, that'd mean full reloads on navigation
  187. bluewait, that's what we *want* to do with target static, no?
  188. phalethI think the proposal says something different, but hold on that thought now
  189. phalethI'll log into github and mark the PR as ready
  190. phalethand let you test that change
  191. phalethon brave
  192. blueyeah the proposal is a bit more contrived
  193. bluesomething like, there's a JSON file for the mds or smth
  194. phalethyeah, but don't worry about that
  195. phalethfirst please check if whatever I did works in brave
  196. phaleththe file is like 1.27 kBs unminifield vs 717 Bs minified
  197. phalethwhich is not much
  198. phalethno need to rewrite primate cause of that :D
  199. phalethcause if that works then full page reloads are fine
  200. blueya
  201. blueyeah, this markdown redo is overdue anyway
  202. blueand --target=static, too
  203. phalethfor primate website I'm gonna work on making the JS bundle size smaller, but first I need to make sure everything happens client side
  204. phalethand this light/dark thing is being tricky
  205. blueya
  206. phalethwhat does FileRef.debase do? gives you the filename?
  207. phalethor I think it's more like fs.debase
  208. phalethah, it expects args
  209. bluegive /tmp/a/b being the 'base', and tmp/a/b/c/d.js being the fileRef, it allows you get c/d.js,
  210. bluegiven*
  211. phalethah, ok, seems like it always returns the subpath with starting forwardslash
  212. blueya, that's unfortunate, I wanted to fix that annoying forward slash
  213. blueotherwise just do .slice(1)
  214. phaleththis this.#serve_assets.client that you've mentioned is being populated out of nowhere and only during production not serve but build I guess