These are chat archives for mithriljs/mithril.js

24th
Aug 2017
spacejack
@spacejack
Aug 24 2017 01:57
@JAForbes submitted an issue re: lift if you have any additional notes/corrections.
Jonah
@jonahx
Aug 24 2017 03:27
@JAForbes what is the current state of web components? every time i investigate it looks good but then either the support is bad or you have to use MB+ polyfills. has this changed?
James Forbes
@JAForbes
Aug 24 2017 04:06
@spacejack nice looks good

I think all but chrome needs polyfills, not even sure about that. But the reason I bring it up is we do support custom elements, elements with a - in the name will call setAttribute intead of directly modifying the element via assignment which is necessary for wc's to intercept changes and do custom logic.

I figure if we've already got the functionality, we may as well boast about it on a site with only 3 other vdoms on it and lots of attention (on twitter at least).

Isiah Meadows
@isiahmeadows
Aug 24 2017 06:30

@JAForbes @jonahx (re: custom element support) Here's the current browser support:

Note: none of these currently support customized built-in elements like <button is="my-button">.

Yatekii
@Yatekii
Aug 24 2017 07:23
hi folks
anyone wanna provide me help with rollup ... again? :D
i don't get the packagesystem of node and stuff it's broken beyond belief lol
Rasmus Porsager
@porsager
Aug 24 2017 07:28
@Yatekii sure, let's have a look at it ;)
Did you move over to the more simple setup since we spoke last?
Yatekii
@Yatekii
Aug 24 2017 07:31
ouuu you are asking the hard questions :P I guess not ... because I am dumb ... but I feel like it's not about rollup really but about me not understanding UMD/AMD and stuff ...
ok now I broke sth for real I feel ... now it's stuck while building :P before it just had some wanrings it didn't find files
Rasmus Porsager
@porsager
Aug 24 2017 07:32
Hehe :P No, it really is a jungle, we're all running around like headless chicken ;)
Yatekii
@Yatekii
Aug 24 2017 07:32
so generally when i add a node module with yarn. how do I know how to import it? I mean, is it trial and error?
ahhhh why is nobody fixing it, it's seriously stupid and I actually like what JS can do but without a proper build env it's so painful :S
Rasmus Porsager
@porsager
Aug 24 2017 07:33
That's why it's best to keep it simple in my opinion, and expand it as you go.. In that way you'll know why all the weird stuff is there ;)
most of the times it's import something from 'something'
Yatekii
@Yatekii
Aug 24 2017 07:34
ya
well I installed a package called pikaday and now I am stuck with
warning Error running install script for optional dependency: "C:\\Users\\chnohue\\repos\\Micafil_Code\\Micafiles\\MicafilesWeb\\node_modules\\weak: Command failed.\nExit code: 1\nCommand: C:\\windows\\system32\\cmd.exe\nArguments: /d /s /c node-gyp rebuild\nDirectory: C:\\Users\\chnohue\\repos\\Micafil_Code\\Micafiles\\MicafilesWeb\\node_modules\\weak\nOutput:\nC:\\Users\\chnohue\\repos\\Micafil_Code\\Micafiles\\MicafilesWeb\\node_modules\\weak>if not defined npm_config_node_gyp (node \"C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\node-gyp-bin\\\\..\\..\\node_modules\\node-gyp\\bin\\node-gyp.js\" rebuild )  else (node \"\" rebuild ) \r\ngyp info it worked if it ends with ok\ngyp info using node-gyp@3.6.2\ngyp info using node@8.1.2 | win32 | x64\ngyp ERR! configure error \ngyp ERR! stack Error: Can't find Python executable \"C:\\Users\\chnohue\\AppData\\Local\\Programs\\Python\\Python36-32\\python.EXE\", you can set the PYTHON env variable.\ngyp ERR! stack     at PythonFinder.failNoPython (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\lib\\configure.js:483:19)\ngyp ERR! stack     at PythonFinder.<anonymous> (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\lib\\configure.js:508:16)\ngyp ERR! stack     at C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\graceful-fs\\polyfills.js:284:29\ngyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)\ngyp ERR! System Windows_NT 6.1.7601\ngyp ERR! command \"C:\\\\Program Files\\\\nodejs\\\\node.exe\" \"C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\node_modules\\\\node-gyp\\\\bin\\\\node-gyp.js\" \"rebuild\"\ngyp ERR! cwd C:\\Users\\chnohue\\repos\\Micafil_Code\\Micafiles\\MicafilesWeb\\node_modules\\weak\ngyp ERR! node -v v8.1.2\ngyp ERR! node-gyp -v v3.6.2\ngyp ERR! not ok"
info This module is OPTIONAL, you can safely ignore this error
hmm well node formatting
maybe this is better: https://pastebin.com/HVruaCdY
Rasmus Porsager
@porsager
Aug 24 2017 07:35
Ok, so this looks like it needs extra build tools.. It's failing at npm install right?
Yatekii
@Yatekii
Aug 24 2017 07:36
so the fun part is: it says you can safely ignore ... leaving the fact aside that warnings are triggering my OCD, yarn now can't exit the build step
it's just stuck with no errors ...
well I use yarn but ya
Rasmus Porsager
@porsager
Aug 24 2017 07:36
Yeah, so some modules can build some native stuff to perform better, but will work fine without, so this is maybe the case here.. Could also be it's only for testing it's needed.
Yatekii
@Yatekii
Aug 24 2017 07:37
hmm hk
but it makes no sense that my yarn build doesn't work anymore now :P
sec imma doa test
hmm it really seems to be this
dang
Rasmus Porsager
@porsager
Aug 24 2017 07:41
ok, so if you remove pikaday stuff works again ?
Yatekii
@Yatekii
Aug 24 2017 07:47
nah I just tried :P
I odn't get it ...
ok I am completely irritated now
Rasmus Porsager
@porsager
Aug 24 2017 07:49
Is the code something you can show?
Yatekii
@Yatekii
Aug 24 2017 07:49
sure
/*
Builds a UMD bundle that is updated with each file change
*/
import umdConfig from "./rollup.umd.js";
import livereload from "rollup-plugin-livereload";
import serve from "rollup-plugin-serve";


const env = process.env; // eslint-disable-line no-undef

const watchDir = env.WATCH_DIR;
if (!watchDir) {
  throw("Missing WATCH_DIR: no watch directory");
}
console.log('kek')
const serverPort = parseInt(env.PORT, 10);
if (!serverPort) {
  throw("Missing PORT: no http server port");
}
console.log('kek')
const targetConfig = Object.assign({}, umdConfig);
console.log('start serving')
targetConfig.plugins.push(
  serve({
    contentBase: watchDir,
    port: serverPort
  })
);

targetConfig.plugins.push(
  livereload({
    watch: watchDir
  })
);

console.log('kek')

export default targetConfig;
I added some console.log()s for debugguing
the weird part is:
the very first import
waaaaait
maybe I am debugging at the wrong place like a moron
ok I sent you the wrong file but doiens't change the fact
I do a rollup -w -c ./rollup.config.js
the rollup,config.js looks like:
import umdConfig from "./rollup/rollup.umd.js";

export default umdConfig;
ah mabye now ...
umd.js looks like:
/*
Build to an Universal Module Definition
*/
import { pkg, createConfig } from "./rollup.base.js";
// import uglify from "rollup-plugin-uglify";

const env = process.env; // eslint-disable-line no-undef
const includeDepencies = true; // Use `false` if you are creating a library, or if you are including an external script in html
const dest = env.DEST || pkg.main;
const baseConfig = createConfig({ includeDepencies });
const targetConfig = Object.assign({}, baseConfig, {
  dest,
  format: "umd",
  sourceMap: true
});

// targetConfig.plugins.push(uglify());

export default targetConfig;

console.log('kek')
Rasmus Porsager
@porsager
Aug 24 2017 07:52
Unknown.jpeg
Yatekii
@Yatekii
Aug 24 2017 07:53
the fun part is;:
the kek at the last line gets printed
but rollup then will be stuck after
I have no clue anymore ...
no error no nothing
haha that gif :D
Rasmus Porsager
@porsager
Aug 24 2017 07:55
sorry, hungry baby.. I'll be back in a bit..
Yatekii
@Yatekii
Aug 24 2017 07:56
hf!
James Forbes
@JAForbes
Aug 24 2017 07:56
Thanks @isiahmeadows :clap:
Yatekii
@Yatekii
Aug 24 2017 08:04
p. sure it's a windows problem as always ...
rebooting p. quick
Yatekii
@Yatekii
Aug 24 2017 08:14
ok I just did a complete git reset to the latest working commit and did a reboot
it's still not building
ok nop idea
fuck git bash
fuck windows
works with cmd
@porsager guess it resolved itself for now
and btw I scaled the config down like you said last time
I was looking at the wrong file partly
but that wasn't the cause
still not building in git bash
but building in cmd/"power"shell
Evgeniy Labutin
@LabEG
Aug 24 2017 08:21

:point_up: 24 августа 2017 г., 10:52

this is simvol of corruption in russia =)

Yatekii
@Yatekii
Aug 24 2017 08:41
hmm if I click back in my browser I always have to click 2 times untiol something happens ... is there any reason for this behavior?
Rasmus Porsager
@porsager
Aug 24 2017 09:12
@Yatekii it looks like it can't find the Python Path in git bash. You could try to set it manually?
@Yatekii Are you using m.route?
Yatekii
@Yatekii
Aug 24 2017 09:14
@porsager well i tried that with the python path already for hours ... not workth it :S and that's only for the compilation, not for rollup bundling itself ... that one doesn't say anything at all in git bash :P it's just stuck :P (after initiald ebug output I put)
and yes, i am using m.route
maybe I have a broken lifecycle (I suspect I am at fault and not mithril)
Rasmus Porsager
@porsager
Aug 24 2017 09:15
Ok, are you calling m.route.set anywhere?
Yatekii
@Yatekii
Aug 24 2017 09:16
pretty sure ya
will have a quick grep
or what ever that crappy search in VS is :P
Rasmus Porsager
@porsager
Aug 24 2017 09:16
I ❤️ The sublime search 😊
Yatekii
@Yatekii
Aug 24 2017 09:16
yap using it at 4 places
I despise the sublime search :p I am unable to use it
:D
well the infile search is awesome
multiple files not so much tb
Rasmus Porsager
@porsager
Aug 24 2017 09:17
Any one of those places in oninit?
Yatekii
@Yatekii
Aug 24 2017 09:17
(I always get that compiled list of entries it found as a new open document) (that sux)
hmm there is a:
document.body.onhashchange = function () {
        m.route.set(window.location.hash.replace('#!', ''));
    };
in onLoad :S maybe that's bad
hmm but none of the otzhers is in onInit
Jonah
@jonahx
Aug 24 2017 09:27
@isiahmeadows thanks for summary. my takeaway is: not really feasible to use in production yet...
Rasmus Porsager
@porsager
Aug 24 2017 09:28
@Yatekii do you know why it's there? Could very well be the culprit.. Do you set m.route.prefix anywhere?
Yatekii
@Yatekii
Aug 24 2017 09:34
no I have no clue ^^ will ask my coworker
and nope there is no prefix set
ah I guess that's because of IE or something
the hashchange
Rasmus Porsager
@porsager
Aug 24 2017 09:39
Ah yeah I remember looking into that at some point as well.. Shouldn't be a problem unless you want html5 path mode (setting m.route.prefix = '')
What ie version, and what problem did it solve?
Yatekii
@Yatekii
Aug 24 2017 09:43
uhm I can't remember that one ... it's just IE ... it's broken by definition ...
:S
Rasmus Porsager
@porsager
Aug 24 2017 09:45
Hehe. Well if it's has to be there, maybe put it in an IE conditional 😉 Does removing it fix the problem BTW?
Yatekii
@Yatekii
Aug 24 2017 09:53
ya, we will try :)
Dominik Dumaine
@Bondifrench
Aug 24 2017 12:36
Sad news: Lichess is moving from Mithril to Snabdom :-( Lichobile, the mobile version is written with Mithril 1.1.3 though, not all is lost
brlewis
@brlewis
Aug 24 2017 12:49
I did not know about Snabbdom. The declarative attributes when removing, etc., seems interesting but limited. Not hard to do the same thing with lifecycle methods.
Yatekii
@Yatekii
Aug 24 2017 13:00
@porsager yep thata ctually fixes the issue :)
Patrik Johnson
@orbitbot
Aug 24 2017 13:15
was there some reasoning behind the moving to Snabbdom, in a GH issue or something?
cavemansspa
@cavemansspa
Aug 24 2017 15:06
how do snabbdom and mithil differ (i.e. is snabbdom just the m() and m.render() of mithril)?
they look similar but looks like snabbdom doesn't include additional functionality (e.g. autoredraw, m.request(), m.route(), streams)
Boris Kaul
@localvoid
Aug 24 2017 16:05
last time I checked, snabbdom/vue2 had the worst children reconciliation behavior among all vdom libraries
Fred Daoud
@foxdonut
Aug 24 2017 16:53
@Bondifrench did moving from Mithril to Snabbdom led to performance improvements for Lichess?
@cavemansspa indeed snabbdom is focused on just being a vdom lib whereas mithril has a larger scope. Biggest difference when coding views is that snabbdom distinguishes between attributes and properties on elements.
Pierre-Yves Gérardy
@pygy
Aug 24 2017 17:00
It looks like @ornicar is gradually moving to TypeScript/Snabbdom, from JS/Mithril v0.2. The simul perfStat learn insight editor ui modules are yet to be rewritten. In both cases he uses a fork of his own.
Fred Daoud
@foxdonut
Aug 24 2017 17:05
I'm curious about the reasons for the Mithril → Snabbdom move. Just performance? Is Snabbdom that much faster than Mithril?
brlewis
@brlewis
Aug 24 2017 17:30
I'm looking at moving from JS/Mithril to TypeScript/Mithril
matrixbot
@matrixbot
Aug 24 2017 17:35
@tuckerm:matrix.org Typescript and Mithril are a great combo.
spacejack
@spacejack
Aug 24 2017 18:38
I concur
Dominik Dumaine
@Bondifrench
Aug 24 2017 21:18
@foxdonut That's what they say in their blog, for improved performance. "It feels much snappier". They also moved to Typescript for 'robustness`.
spacejack
@spacejack
Aug 24 2017 22:52
They probably could've stuck with mithril and used m.render