GithubHelp home page GithubHelp logo

Better README with Documentation about monolite HOT 9 OPEN

kube avatar kube commented on May 31, 2024
Better README with Documentation

from monolite.

Comments (9)

spacejack avatar spacejack commented on May 31, 2024 1

Yeah, definitely. I'd probably use it if that were in place. I doubt performance would be an issue in my case and am not too concerned about it on IE or old Android Browser anyway - just so long as it works.

from monolite.

spacejack avatar spacejack commented on May 31, 2024

I would add a note about requiring Proxy support. Sadly I can't use it. :(

from monolite.

kube avatar kube commented on May 31, 2024

@spacejack This is something that I'm already aware, but did not take time to fix: You can check #2 for more information.

I'm currently working on Electron applications, so I don't have this kind of issue right now, but as I will have soon to target browsers again, I need to find a solution for that.

What kind of build process do you use? This should be easily fixed, but my real problem is to find the correct tool to use.

TypeScript

Using TypeScript compiler would need to create a custom transpiler using TypeScript API, which would do the transformation before calling the real TypeScript compiler.

The goal of this transpiler would only be to resolve the Accessor Function statically.

It would mean another build process step, as it's currently not possible to plug custom AST transform functions in the TypeScript compiler.

Another solution would be to create a wrapper around the TypeScript compiler, and call this custom compiler for Production. But it's kinda strange to create a wrapper of TSC for just one little functionality.

Babel

Babel provides a simple way to plug custom transform functions, but it would mean to use both TypeScript AND Babel during build.


I still did not decide which solution I would choose.

What kind of build process did you setup? Also, do you use Webpack or Gulp? What environments are you targeting?

from monolite.

spacejack avatar spacejack commented on May 31, 2024

I'm using pretty minimalist tooling - so browserify/tsify. I'm not sure I'd add additional tooling just for this unless I was going to make heavy use of it. Possibly on a future project though.

Babel seems like a reasonable approach, though I haven't spent a lot of time looking at how to add Babel to my pipeline.

from monolite.

kube avatar kube commented on May 31, 2024

Just a little question about what your target is:

If you target browsers in general, and performance in old browsers (those that do not support ES2015) is not a real problem, there's a way to add support (in a dirty way).

Today I use a Proxy to convert Accessor Function to Accessors Chain, but this could fall back on a Regex-based resolution if there's no support for Proxy.

Something like:

const getAccessorChainWithoutProxy = (accessorFn: Function) =>
  accessorFunction.toString().match(/someregexhere/).andSomeAdditionalTransform()

It's not a clean way to achieve this, and would not be really performing, but has the benefit to work out of the box, even during development, until the Babel plugin is available (and even after).

Maybe even it could be cached if there's a way to detect accessorFunction identity equality.

Would this be something useful for you?

from monolite.

kube avatar kube commented on May 31, 2024

I will add support for ES5 this week-end.

from monolite.

kube avatar kube commented on May 31, 2024

Just for info, I started the Babel plugin:
https://github.com/kube/babel-plugin-monolite

You can already install it using NPM

npm install --save-dev babel-plugin-monolite

It's still in really early stage, but I would love any feedback on it.

from monolite.

bryanerayner avatar bryanerayner commented on May 31, 2024

I have a slightly unrelated question - is the usage of proxies a performance hazard for a Node JS backend? I'm getting away from ImmutableJS and trying to find a safe spot to land.

Also, I believe Typescript is getting to the place where plugins will be possible pretty soon.

from monolite.

kube avatar kube commented on May 31, 2024

@bryanerayner
Just did a little Google search, and the first article seems to say that performance is not heavily impacted by usage of Proxy:

http://dealwithjs.io/es6-features-10-use-cases-for-proxy/#performance

But one thing is that Proxies and Reflection in general make harder JIT optimisation.
I did not make a benchmark myself at the moment, but it's something I'm gonna need to do soon.

If you have a real need of performance, I suggest you to use the Babel Monolite Plugin. It's still early stage, but it will permit to resolve accessors statically.

Let me know if you start using it, I would really like to have feedback on it. (And enhance it too)

from monolite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.