Coder Social home page Coder Social logo

Comments (5)

herschel666 avatar herschel666 commented on June 27, 2024 1

I mostly agree with @ZauberNerd here. I would add though that version 4 makes it too easy to overwrite the setting and thus provides kind of a foot gun. I also right now can't think of a situation where a preset would want to change the visibility set by a previous preset.

So I'd be in favour of variant 3.

It still provides a way to change the setting, which could be applied by users and preset authors alike. So coming from a preset that looks like that…

{
  "secret": "[SUPER_SECRET]"
}

…ppl could expose the value like this…

{
  "secret": "[SUPER_SECRET]",
  "meDontCares": "<secret>",
  "whitelist_array": ["meDontCares"],
}

from untool.

dmbch avatar dmbch commented on June 27, 2024

Another option would be to introduce an object (e.g. serverOnly) that would be merged and generally handled separately and that could hold the appropriate props and hidden from the client.

That being said, my personal preference would be option 1 or 2..: these appear to be most aligned with framework and ecosystem standards and conventions.

from untool.

ZauberNerd avatar ZauberNerd commented on June 27, 2024

I would prefer to white-list keys that should go to the client-side instead of black-listing them (which would be kind of the case with serverOnly).

I don't like variant 2 and 5 because then a user could overwrite the default value that comes from a preset and would lose the visibility settings.

With variant 1 we would need to change our code whenever the visibility changes (or build some complicated getter/proxy stuff around it), therefore I would prefer variant 3 or 4.
I think I'm leaning more towards variant 4, because that would allow later presets / the application config to overwrite the visibility of values, but since it will always be merged it is safe by default.

from untool.

dmbch avatar dmbch commented on June 27, 2024

If we did decide to go with variant 3, we would have to deal with that array like with mixins - and that would be breaking abstractions, unfortunately: we would be introducing knowledge about the distinction between client and server to @untool/core - and that is something it is not really supposed to know about.

I would therefore prefer going with variant 4 and implement it in @untool/webpack.

from untool.

herschel666 avatar herschel666 commented on June 27, 2024

I consider this decided & done!

from untool.

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.