{ "id": "173761", "key": "TIMOB-27150", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "20412", "name": "Release 8.1.0", "archived": false, "released": true, "releaseDate": "2019-08-13" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-07-08T16:45:21.000+0000", "created": "2019-06-14T17:41:02.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "updated": "2019-07-16T10:16:38.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "With 8.0.X versions of the SDK, I could include a bootstrap file with my package before I published it to npm which then allowed me to define an alias for use with Titanium.\r\n\r\nrequire('/ti.internal/extensions/binding')('axios', '/node_modules/@titanium/axios');\r\n\r\nWith the 8.1.x releases, the code has changed and is rolled up, which blocks access to the functions necessary to do this.\r\n\r\nI will submit a PR that modifies the code to allow it.", "attachment": [], "flagged": false, "summary": "Add ability to alias required modules in Titanium", "creator": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "environment": null, "closedSprints": [ { "id": 1153, "state": "closed", "name": "2019 Sprint 15", "startDate": "2019-07-15T18:30:38.331Z", "endDate": "2019-07-28T18:30:00.000Z", "completeDate": "2019-07-29T15:34:51.860Z", "originBoardId": 114 }, { "id": 1149, "state": "closed", "name": "2019 Sprint 14", "startDate": "2019-07-01T16:55:04.813Z", "endDate": "2019-07-14T16:55:00.000Z", "completeDate": "2019-07-15T15:41:02.311Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "449088", "author": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "Added PR: https://github.com/appcelerator/titanium_mobile/pull/10961", "updateAuthor": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2019-06-14T17:43:23.000+0000", "updated": "2019-06-14T17:43:23.000+0000" }, { "id": "449463", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "New PR: https://github.com/appcelerator/titanium_mobile/pull/11009", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2019-06-28T17:39:09.000+0000", "updated": "2019-06-28T17:39:09.000+0000" }, { "id": "449640", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "merged to master and 8_1_X. \r\n\r\nThis is an unadvertised/un-documented new \"feature\" that we use internally to register our Node compatible shims so they get returned by calls to require. Per Brenton's request, the API is now available to users, but I don't know how much we want to advertise this. cc [~emerriman] [~amukherjee]\r\n\r\nBasically it's now accessed via:\r\n{code:javascript}\r\n// to hijack require('original.module.id') to actually load some specific JS file...\r\nglobal.binding.redirect('original.module.id', '/my/special/override');\r\n// or to hijack require('original.module.id') to return a specific object/value acting like module.exports...\r\nglobal.binding.register('original.module.id', value);\r\n{code}", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2019-07-08T16:45:21.000+0000", "updated": "2019-07-08T16:45:21.000+0000" }, { "id": "449644", "author": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "(*) (*) Thank you [~cwilliams] !!! (*) (*) ", "updateAuthor": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2019-07-08T16:56:29.000+0000", "updated": "2019-07-08T16:56:29.000+0000" }, { "id": "449835", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Closing ticket*, feature verified in SDK version {{8.1.0.v20190715143102}} and SDK version {{8.2.0.v20190712143331}} Was able to alias required modules in Titanium using the following test case:\r\n*app.js*\r\n{code:java}\r\nglobal.binding.redirect('appc.rocks', '/afile.js');\r\nglobal.binding.register('appc.super.rocks', 'appc truly does rock');\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\nwin.open();\r\nwin.addEventListener('click', () => {\r\n require('appc.rocks');\r\n});\r\n{code}\r\n*afile.js*\r\n{code:java}\r\nconst whatDoesappcDo = require('appc.super.rocks');\r\nconsole.log(whatDoesappcDo);\r\n{code}\r\n\r\n*Test Environment*\r\n{code:java}\r\niPhone 6 12.2 sim\r\nAndroid pixel XL 7.1.1. Emulator \r\nMacOS Mojave version 10.14.4\r\nXcode 11 Beta 3\r\nNode.js ^8.12.0\r\n\"NPM\":\"4.2.13\",\"CLI\":\"7.1.0-master.24\"\r\n{code}\r\n", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-07-16T10:11:19.000+0000", "updated": "2019-07-16T10:11:19.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }