Posts
Factoids
RSS Reader
Karma
Logs
Tags
Atlas
Back to the channels
#primate
Previous day
24 May 2026 (America/New_York)
Next day
02:06 phaleth onMount is difficult to replace
02:38 phaleth looks like html components cannot handle ES6 imports, is that the case? https://images4.imagebam.com/e9/ac/29/ME1DC245_o.png
02:39 phaleth I mean views
04:07 blue phaleth: I think it should work, I'll investigate why
06:35 phaleth ok, cool, the apps/html example does not have any script tag in views
06:38 blue that's bad
06:57 phaleth maybe the example is just old
07:15 blue phaleth: https://github.com/primate-run/primate/commit/5a8842add692231d71bb28bbc9498e7ed2428359
07:15 nevet html: support imports · primate-run/primate@5a8842a
07:18 phaleth esbuild is used now, nice
07:21 blue I should probably improve it to minify in production, but couldn't be bothered for now
07:23 blue so technically fyi phaleth, this isn't the case right now, but if html really tapped onto the primate build system, you should potentially also import svelte components, in case they're configured to act like web components
07:23 blue you could*
07:24 blue but this would requiring a larger rewrite of @primate/html, and also the ability to configure svelte to emit web components, which I think is possible, but isn't available in @primate/svelte right now
07:24 blue require*
07:25 blue I've been playing around with marko v6 and the next primate release will have support for csr in marko, and it has some interesting concepts
07:26 phaleth is the bundle size with marko small?
07:26 blue I haven't checked, to be honest
07:26 blue so they support top level imports inside .marko components, which is interesting
07:26 phaleth svelte brings in about 23 kBs gziped of some unused vite garbage or whatever
07:26 blue oh god
07:26 blue the pivot around vite is terrible: vite is overengineered garbage that should never exist in an ideal universe
07:27 blue the answer has always been esbuild
07:27 blue why should a frontend framework concern itself with delivering bundler integration, above all in its *core* package
07:27 blue at least marko has @marko/vite, which you don't have to tap onto if you don't want
07:29 blue anyway, in marko you can do, `import SomeTag from "../lib/SomeTag.marko"; <SomeTag />`
07:29 blue I think that's elegant, it's nearing my idea of how things should be in frontend. I'd consider putting the template part inside <template> to make it less chaotic
07:30 phaleth I've fetched and rebased against master, rebuilt the packages and now when I start primate website I get https://upaste.de/raw/8xk
07:31 blue that looks like a marko error, inside of a svelte component
07:31 blue let me see
07:31 blue probably the marko commit
07:31 phaleth ok
07:32 phaleth can esbuild bundle marko?
07:33 blue yes
07:33 blue ok, turns out I replaced the create-root.ts in svelte with the marko one
07:33 blue let me fix that
07:33 phaleth yeah, no hurry
07:37 blue https://github.com/primate-run/primate/commit/3d572012ef44b395b6a131b8e3e3bb6107f48962
07:37 nevet svelte: restore root · primate-run/primate@3d57201
07:37 blue phaleth: ^
07:37 blue cool thing I just learnt: to get the commit *before* a commit (so the parent commit essentially), you can add ^ to the sha
07:38 blue I did `git restore --source=acf65633b6d0372e32e653754f877ee69adf8b6e^ create-root.ts`
07:38 blue got the source with `git log -n 1 -- create-root.ts`
07:40 blue in one command: `git restore --source="$(git log -n 1 --format=%H -- create-root.ts)^" create-root.ts`
07:41 blue obviously you can script around that to do something like `restore-last create-root.ts` or so
07:42 phaleth getting a new error https://upaste.de/raw/no3
07:57 blue hm
08:01 blue phaleth: try again
08:01 blue last commit should be `svelte: restore deleted files"
08:32 phaleth getting the previous error again https://images4.imagebam.com/44/a8/05/ME1DC8CU_o.png
08:33 blue phaleth: did you recompile @primate/html?
08:35 phaleth yeah, the picture shows that
08:35 phaleth oh, actually it's cut off
08:35 phaleth but in any case yeah
08:36 phaleth that error appears at runtime btw
08:37 blue hm
08:37 blue but you can run `apps/html` and browse to /script ?
08:39 phaleth yeah, I can and I get `Hello, bar` on that page and no error
08:39 phaleth I guess I should just push the code I have to a branch
08:41 blue are you sure? this is working for me
08:41 blue I created docs2.html
08:41 blue then put `import theme from "#config/theme";` in it, and a console.log
08:41 blue then returned it from a route, and it works
08:47 phaleth yeah, well, take a look at the wip-dont-merge on my fork
08:48 blue ok
08:52 phaleth latest deno is much faster than previous one, kind of on par with node
08:53 blue cool
08:53 blue phaleth: I looked at the branch
08:53 blue this is a misunderstanding
08:54 blue variables inside the `<script>` block aren't available as template variables
08:54 blue template variables are props
08:54 blue so ${theme} would require you passing a `theme` prop to docs.html
08:54 phaleth ah, ok
08:57 phaleth that means every variable needs to be a prop?
08:57 phaleth like for example size
08:58 blue well yes. or you set it dynamically via querySelector
08:58 phaleth dang :)
08:58 blue well, we need poly, there's only so much html tmeplates can do
08:59 blue speaking of which, what do you find better?
08:59 phaleth but poly will also bring in the svelte compiler?
08:59 blue https://dpaste.com/3YFKRQV96
08:59 blue https://dpaste.com/9AF828WK5
08:59 blue no, poly will have nothing to do with svelte
08:59 phaleth the client side bundle size is the problem with svelte
08:59 blue yes, that will be as tiny as possible
09:00 phaleth ah, ok, so you are already working on something new
09:00 blue yes
09:01 phaleth the first one with template tag looks good
09:01 blue so poly will feel very much like svelte 3/4
09:01 phaleth but the second one should work if you save it as html file
09:01 phaleth I mean editors should have no problems then
09:02 blue except that instead of a magical let, we have a `signal` keyboard, and instead of magical export let being props, we'll have the prop keyword
09:02 blue so you're saying the second form is better for editors?
09:02 phaleth yeah, signal means state
09:02 phaleth could also call it state
09:03 blue I mean, it doesn't particularly matter because editors wouldn't be able to parse it correctly because of the two new keywords
09:03 phaleth yeah, the second one with script tag can just go into html file
09:03 blue yeah
09:03 blue the main attractive part is that .poly will be ts-first
09:04 phaleth ah, so maybe if you want ts extension to work then the first one is better
09:04 blue so `prop foo: number;` and `signal bar: string = "bar";`
09:04 phaleth or tsx if you want a template lang
09:04 blue the main thing I care about is not having magic here
09:04 phaleth tsx is actually not as bad as react's tsx
09:04 phaleth react kinda screwed it up
09:05 blue royally
09:05 phaleth and esbuild has no problem transpiling tsx
09:05 blue but tsx won't recognise things like `signal bar: string;`, no?
09:05 blue or is it extensible?
09:06 phaleth yeah, you'll have to add a preprocessor
09:06 phaleth but for editors you can use tsx extension I guess
09:06 blue the main concern are editors, but I guess for that you need a plugin/language server
09:07 blue anyway, I think svelte 3/4 nearly nailed it, but then they moved on to the rune nonsense, because, you know, toxic community and so on
09:07 phaleth nah, there is always something underlined with red squiglies with TS in the editor
09:07 phaleth as long as the compiler is good with the code then the code is good
09:07 blue ya
09:08 phaleth svelte 3 was peak frontend tech
09:08 phaleth zero dependencies
09:08 blue yup
11:34 phaleth blue: can you tell if this is the correct way to setup an esbuild plugin? the size of the app bundle didn't change https://images4.imagebam.com/17/e1/7d/ME1DCDWD_o.png
12:15 phaleth yeah, esbuild-svelte is being picked up by the core https://images4.imagebam.com/e8/92/e0/ME1DCERE_o.png
12:16 phaleth maybe it should go first before svelte plugin?
Search posts