Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1570] Alloy: exports.baseController does not work since 1.10.0 (Regression)

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-06-22T18:18:55.000+0000
Affected Version/sAlloy 1.10.0
Fix Version/sCLI Release 6.3.0, Alloy 1.10.3
ComponentsTooling
Labelsn/a
ReporterSergey Nosenko
AssigneeChristopher Williams
Created2017-06-20T12:58:39.000+0000
Updated2017-10-10T19:26:15.000+0000

Description

since 1.10.0 exports.baseController = 'name' does not work. I attached simple project with three controllers * Base * BasedOnBase with exports.baseController = 'base' in js * BasedOnBaseXML with in xml With Alloy 1.9.11 I got correct result in both cases:
function Controller() {
    require("/alloy/controllers/Base").apply(this, Array.prototype.slice.call(arguments));
...
but with Alloy 1.10.x I get correct code only for BasedOnBaseXML for BasedOnBase I get:
	require('/alloy/controllers/' + 'BaseController').apply(this, Array.prototype.slice.call(arguments));
	this.__controllerPath = 'BasedOnBase';
	this.args = arguments[0] || {};

	if (arguments[0]) {
		var __parentSymbol = __processArg(arguments[0], '__parentSymbol');
		var $model = __processArg(arguments[0], '$model');
		var __itemTemplate = __processArg(arguments[0], '__itemTemplate');
	}
	var $ = this;
	var exports = {};
	var __defers = {};

	$.__views.BasedOnBase = Ti.UI.createView({ id: "BasedOnBase" });
	$.__views.BasedOnBase && $.addTopLevelView($.__views.BasedOnBase);
	exports.destroy = function () {};

	_.extend($, $.__views);

	var args = $.args;
	exports.baseController = 'Base';

Attachments

FileDateSize
app.zip2017-06-20T12:54:38.000+00007419

Comments

  1. Christopher Williams 2017-06-20

    Likely related to move to babylon/babel. I modified https://github.com/appcelerator/alloy/blob/master/Alloy/commands/compile/ast/controller.js and it seems maybe it's not grabbing the controller name properly now? I think it may be a simple typo: 'export.baseController' vs 'exports.baseController'
  2. Christopher Williams 2017-06-20

    https://github.com/appcelerator/alloy/pull/832
  3. Sergey Nosenko 2017-06-20

    If you release 6.20 without this it will be broken. :(
  4. Ewan Harris 2017-06-22

    [~darknos] The 'Release 6.3.0' refers to the Appcelerator CLI release version, it is currently at 6.2.2, as opposed to the 6.1.0 of Titanium SDK. If you are not using the Appc CLI, (Titanium CLI+Alloy) this change will be in Alloy 1.10.3
  5. Abir Mukherjee 2017-10-10

    Node Version: 6.10.3 NPM Version: 3.10.10 Mac OS: 10.13 Appc CLI: 6.3.0-master.7 Appc CLI NPM: 4.2.9 Titanium SDK version: 6.2.2 Validated with the environment. I tested with the attached app, and app functioned as expected. No errors were seen.

JSON Source