Comments (5)
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.
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.
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.
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.
I consider this decided & done!
from untool.
Related Issues (20)
- Allow custom template for react server HOT 5
- Make importComponent work in test environments HOT 9
- Travis checks broken
- @babel/polyfill polyfills resolve to wrong `core-js` version on compile time HOT 4
- Warnings for "un build" with new babel / core-js versions HOT 1
- Webpack: Signal based HMR crashes on windows HOT 1
- Allow to build/start specifc targets only HOT 3
- Should the doctor throw in production mode instead of printing warnings HOT 2
- @babel/preset-env needs to be updated HOT 2
- Action Required: Fix Renovate Configuration HOT 1
- [RFC]: default values in config placeholders for environment variables HOT 7
- [RFC]: Replace the snapshot tests with more meaningful code HOT 2
- [RFC] Allow to set a rootDir in untool HOT 1
- Routing broken with react-router v5.1 HOT 1
- Dependency Dashboard
- environmentalize does not work with object whitelisting
- utils environmentalize fails with item.replace is not a function HOT 6
- Build error: External library using `preset` with invalid configuration
- Forward and respect webpack magic comments HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from untool.