Compile core files AoT and remove builder references from core #8
Replies: 14 comments
-
I was going to open a similar issue, but mainly about extracting core flavor into it's own package. |
Beta Was this translation helpful? Give feedback.
-
I would love to see that extracted out in a package. Other flavors don't need this |
Beta Was this translation helpful? Give feedback.
-
That was going to be my suggestion, but as @NathanaelA said in a TSC meeting, many plugins use the core flavor for custom views. I think it all boils down to how big of a breaking change we want to introduce If we do want to move forward with removing the core flavor, I think we'll be able to clean up a good chunk of functions from core, like |
Beta Was this translation helpful? Give feedback.
-
When you say plugins depend on core flavor can you elaborate? Not sure I see the issue. |
Beta Was this translation helpful? Give feedback.
-
No, I mean some plugins actually have a xml file with their layouts and inflate them when needed. This is just something to consider when we introduce this breaking change. |
Beta Was this translation helpful? Give feedback.
-
@edusperoni ok ! have not seen that anywhere but you are right, have to be considered |
Beta Was this translation helpful? Give feedback.
-
Would be useful to gather a few plugins that do this - and perhaps we can handle them in an xml-loader without requiring plugins to change. Webpack would compile the xml and it would be passed to the same runtime methods these plugins use, but handled seamlessly. (this definitely needs thorough testing - but should be doable - unless the xml is generated from for eg. string literals) |
Beta Was this translation helpful? Give feedback.
-
Here’s a plugin that we use often that uses string literal: |
Beta Was this translation helpful? Give feedback.
This comment was marked as disruptive content.
This comment was marked as disruptive content.
-
I believe we can probably do some parsing and try to compile AoT those string literals. Things would probably get hairy with template strings, though. Regarding
This could be all extracted from core into a "vanilla" flavor which would do this wiring when the view requires it. Yes, it would also be a big breaking change and plugins would likely need to be updated, which is the same that happened with v7.0 when all package names changed. In fact, @NathanWalker's example still isn't compatible with 7.0. All flavors seem to be able to convert their components' inputs into valid core inputs, it would be really nice if "vanilla" could do the same, even if it were still in the same package as core. I'm working on removing things like |
Beta Was this translation helpful? Give feedback.
This comment was marked as disruptive content.
This comment was marked as disruptive content.
-
@NathanaelA i think registering only the use components is a subject of another rfc but totally doable today for flavors. They use a template compiler which can thus detect which components are.used. |
Beta Was this translation helpful? Give feedback.
This comment was marked as disruptive content.
This comment was marked as disruptive content.
-
@NathanaelA agree on auto registration being more important. But not the same rfc ! So it does not invalidate this one. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Nativescript's core flavor isn't tree-shakeable due to it being JIT compiled, which requires fully fledged parsers and the UI Builder to be bundled with every Nativescript app as they're used by many plugins and even core functions as well.
Proposal: create a xml loader for Nativescript's core flavor so xml files will be converted into their "code-behind" counterparts.
All Builder references from core could then be removed/changed so the functions now would only require a
View
or() => View
, instead of aViewEntry
.This goes hand in hand with #4
Possible breaking changes:
it may be possible to analyze for usages of
ViewEntry
and replace them with the proper imports, but we may need to do something like:to use in showing of modals and other dynamically created pages.
Beta Was this translation helpful? Give feedback.
All reactions