Submit

Back to the channels

#primate

  1. blue hi phaleth
  2. phaleth hi blue
  3. phaleth https://jsx.lol/
  4. phaleth yet another https://html.kitajs.org/
  5. nevet Kita Html - Super-fast JSX Runtime
  6. blue phaleth: LOL
  7. blue I was thinking that poly should not do JSX
  8. blue <if condition={true}>{"hi"}</fi>
  9. blue <for of={[1, 2]} as=yo>{yo}</for>
  10. phaleth ${true ? "hi" : ""}
  11. blue <for in={foo: "bar"} as=[key, value]>{key}</a>
  12. phaleth ${[1, 2].forEach(yo => `${yo}`)}
  13. phaleth is there forEach in JS? I forgot
  14. blue yes
  15. blue yeah but it's always been a crutch. because you kinda have full JS at your disposal, but then you don't
  16. blue the realiyt is you don't need full JS in the <template>
  17. blue you only need a useful subset
  18. phaleth anyway, did yout hink about running the svelte code through the esbuild-plugin to just solve the problem that the website has?
  19. phaleth i mean esbuild-svelte plugin or whatever it's called
  20. blue that's unnecessary
  21. blue @primate/svelte already does everything esbuild-svelte does
  22. phaleth I like that svelte lets me use full JS
  23. phaleth same for JSX
  24. phaleth uh
  25. blue yes but ideally you're never gonna write a full program
  26. blue inside your if tag
  27. blue you just need a bit of logic
  28. blue I'm kinda having fun with marko
  29. blue primate 0.39 is going to have full support for it
  30. blue I think you'd kinda like marko, might even switch to it from svelte for the website
  31. phaleth try to read through that https://primate.run/app-5ZNSRVCY.js I think bundlers can purge half of the thing
  32. blue lol
  33. blue most of it is svelte garbage, anyway
  34. phaleth yeah, I think esbuild-svelte gets rid of a lot of that
  35. blue but we already have an esbuild plugin for svelte, it does the minimum amount of work necessary. or are there any additional flags we're missing?
  36. phaleth if marko produces smaller bundle but is still sort of component or partial template based then I guess we could use that
  37. phaleth you mean esbuild flags? I don't think so
  38. blue no I mean, svelte flags
  39. phaleth I'm just thinking that svelte needs to be preprocessed for production
  40. blue so let's add that to @primate/svelte if it's missing
  41. phaleth I was looking at the svelte compiler flags and non of those made any difference
  42. phaleth yeah, would be great if you could do that, to me it seems impossible
  43. blue so @primate/svelte contains an esbuild svelte plugin
  44. blue which probably does exactly the same thin gin the end like esbuild-svelte
  45. phaleth it just runs the compiler I think
  46. phaleth and the compiler adds in a lot of cruft
  47. phaleth for dev that idea is fine
  48. blue if you look here, this is almost the same as what we do
  49. blue https://github.com/EMH333/esbuild-svelte/blob/main/index.ts
  50. blue also some source map support but that's irrelevant for production
  51. blue there's nothing you're gonna gain from using esbuild-svelte, except for relying on someone else's code, which is almost always bad
  52. blue if you need support for preprocessing, we can add it, and that would mostly amount of passing an option to @primate/svelte and then calling `preprocess`, though what would you gain from? ts is already nativel supported in svelte 5
  53. blue we'd only need it if we wanted support for additional template engines like pug or scss or so, all garbage in its own right
  54. phaleth import sveltePlugin from "esbuild-svelte";
  55. phaleth import { sveltePreprocess } from 'svelte-preprocess';
  56. phaleth preprocess: sveltePreprocess(),
  57. phaleth app.plugin("client", sveltePlugin({
  58. phaleth }));
  59. phaleth it's two things
  60. blue yeah but the preprocessor isn't for optimising the build. it's for supporting magical stuf flike postcss and friends
  61. phaleth I don't really exactly know, but I don't think svelte based sites ship extra 23 gzipped KBs
  62. blue https://github.com/sveltejs/svelte-preprocess
  63. nevet GitHub - sveltejs/svelte-preprocess: A ✨ magical ✨ Svelte preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, Coffeescript, TypeScript, Pug and much more.
  64. blue "Historically, svelte-preprocess was the go-to option whenever you had a language other than JS/HTML/CSS used inside your Svelte files. Today, depending on your setup, you may no longer need it:"
  65. phaleth heh, magical, it's all magical
  66. blue "If you're using Svelte 5 and are only using type features of TypeScript (i.e. things that just "go away" after transpiling to JS), you don't need any preprocessor, Svelte handles this natively
  67. blue "
  68. blue believe me, we're gonna gain nothing from this nonsense, I've been over these packages and they're a bunch of cruft
  69. blue unless we wanna support scss or coffeescript or pug, of all which are useless
  70. phaleth but still why is there half the unnecesary JS in the final bundle
  71. blue I don't know, but I doubt using esbuild-svelte or svelte-preprocess is gonna influence that
  72. phaleth I don't think the compiler just optimizes the output
  73. blue I can't see any magical things they do that we don't do
  74. phaleth so then all esbuild based svelte sites ship extra JS
  75. phaleth that makes rollup the tool of choice for prod builds
  76. phaleth or rolldown or whatever is the thing nowadays
  77. blue I doubt that. though if anything unneeded is pulled in, that would be primate's fault and not esbuild's
  78. phaleth I'm just thinking that cause I remember hello world in svelte was 9 kBs back in the day
  79. blue and then rollup wouldn't do a better job at it, anyway
  80. phaleth yeah, but if you look at that app bundle the first half of it is no primate at all
  81. phaleth and also why make a new framework if svelte is fine :D
  82. blue which part? the svelte error messages?
  83. phaleth yeah, prolly, it's like all the svelte features that are not used are included
  84. phaleth I gotta go, see ya
  85. blue ciao

Search posts