Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to require: the ViewController for a controller: annotation should trigger a warning. #124

Open
johnyanarella opened this issue Oct 9, 2013 · 0 comments
Assignees

Comments

@johnyanarella
Copy link
Member

As part of the transition from the Sencha SDK tools to Sencha Cmd, third-party classes lost the ability to trigger automatic import of classes via syncRequire(). There is a now a special file in the Sencha SDKs defining magic properties that Sencha Cmd considers when evaluating classes to provide auto-require functionality. These properties are specific to Sencha framework classes and any subclasses (ex. the magic model: property in Ext.Store), but there is no public API to do define magic auto-require properties specific to third-party classes.

Currently, in the development environment, Deft JS's controller: class preprocessor syncRequire()'s the specified controller class. When an application is built using the Sencha SDK tools, this triggers automatic inclusion of that dependency in the resulting app.jsb3 file. However, when an application is built using Sencha Cmd, this call is not evaluated (because the class is now loaded into an AST and inspected rather than instantiated with require() and syncRequire() calls tracked to determine its dependencies). Consequently, the specified ViewController class dependency is not automatically included -- resulting in runtime errors that only occur in the production build due to missing ViewController classes.

This creates a negative experience for developers using the Deft JS framework - their application works in the development environment, but not in production.

We should show a warning in the development environment when a ViewController class is specified via controller: but has not been require:-ed. This might be as simple as removing the syncRequire() statement and relying on the standard class loader warning built in to Ext.create() when we attempt to instantiate the specified ViewController class within the controller: class preprocessor.

We should also reach out to Sencha to determine if in future releases of their frameworks they plan is to eliminate the existing magic properties in favor of requiring developers to always make explicit require: statements, or whether there is a chance they will open a public API to allow Sencha Cmd packages to define magic properties similar to those provided as configuration with the Sencha SDKs. It would definitely be a better developer experience to only have to specify the class in the controller: annotation, rather than specifying the class in the controller: annotation and require:-ing it as well.

@ghost ghost assigned johnyanarella Oct 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant