Open stephenmdangelo opened 8 years ago
This adds a code generator to rebuild js functions code, correct?
I am not sure this is the correct way (or even the repo) for that. I will need to think about this a bit. The initial plan was to have a codegen separately, but this in fact does relate to the parser, not a complete codegen.
Could you also link me to an example why this is needed?
This adds a code generator to rebuild js functions code, correct?
Yes, it takes the one from UglifyJS.
I am not sure this is the correct way (or even the repo) for that. I will need to think about this a bit. The initial plan was to have a codegen separately, but this in fact does relate to the parser, not a complete codegen.
Yeah, it's admittedly a hack (I don't even know if I can make this entirely transparent to completely arbitrary JS code that references capitalized variables). I'd love to hear some other ideas of how this could be done. I feel like we could make a babel plugin or something, but that would likely force the use of gulp-qmlweb
, removing the ability to serve up QML files directly (or use Qt.createQmlObject
, all the stuff being discussed in https://github.com/qmlweb/qmlweb/issues/303).
Could you also link me to an example why this is needed?
Here is an example of why this is required: https://github.com/stephenmdangelo/playground/tree/master/qml/scoped_attached_properties
I'm less interested in being able to support qualified imports of QtQuick
, but for custom attached properties (e.g. I'd like to add a custom attached property for QmlWeb that allows one to add CSS classes to an element. I've hacked that together for my own purposes via objectName
).
This is to help support: https://github.com/qmlweb/qmlweb/issues/297
Lots of tests fail, but I'm pretty sure that's just because all of the source is regenerated (though I believe still functionally equivalent). QmlWeb tests that fail are any that reference things like
Qt
andImported
, as there is no$QmlWebGetAttachedObject
defined.I'm mostly interested in any comments about this approach in general. It's currently including a copy of UglifyJS's process.js, with all of the node require/export stuff removed (I couldn't sort out a nice way to put that into replacements.js).