Hi Thiago! I counted 62 matches in 50 files of these 4: - t5/core/events - t5/core/ajax - t5/core/dom - t5/core/alert
Would not be a problem of updating them. Kind regards, Dmitry On Sunday, June 8, 2025, Thiago H. de Paula Figueiredo <[email protected]> wrote: > Hello! > > TL;DR: do your Tapestry projects have JavaScript code that uses Tapestry's > own JS like t5/core/dom, t5/core/zone, t5/core/ajax, etc? How many JS files > have at least one of these dependencies? No exact numbers needed. We're > just trying to figure out the size of possible backward > compatibility problems. > > We've been working on improving the Tapestry's JavaScript support, > including support for ES6 modules[1], creating a non-Require.js mode (based > on ES6 modules) and converting Tapestry's own JavaScript sources from > CoffeeScript to TypeScript. > > The last part should help everyone developing Tapestry's JavaScript, since > CoffeeScript's syntax is way closer to Ruby than to JavaScript itself. In > addition, CoffeeScript is old and its last commit was more than 2.5 years > ago [2], while TypeScript is being actively developed and gaining adoption. > > There's one problem with TS's code generation, though: while it can output > both ES6 modules or AMD ones (the ones used by Require.js), the AMD > modules' exports are done in a bit different way. For example, if you have > this: > > define(["t5/core/dom", "t5/core/ajax"]], function(dom) { > var foo = dom("bar"); > ajax(...); > ); > > you'd need to change your code to > > define(["t5/core/dom"], function(dom) { > // The __importDefault function is generated by the Ts > // compiler and fixes the problem > dom = __importDefault(dom); > ajax = __importDefault(ajax); > var foo = dom("bar"); > ajax(...); > ); > > or > > define(["t5/core/dom", "t5/core/ajax"], function(dom) { > var foo = dom.default("bar"); // Notice the '.default' part > ajax.default(...); > ); > > Notice the changes would only need to be done once, when upgrading to > 5.10.0, and they're simple. > > This problem only happens for Require.js/AMD modules. If, after upgrading > to 5.10.0, your ES6 modules will import the ones provided by Tapestry > normally. There are tools for converting AMD modules to ES6 like > https://github.com/buxlabs/amd-to-es6. If you have a small number of > files, > doing it manually only takes a few minutes each at most (my own experience > while converting Tapestry's AMD modules to ES6) and your code will look > better and more modern in the end. > > We, the Tapestry team, would like to know whether this would be a problem > for your projects, especially if it would prevent upgrading from 5.7.0+ to > 5.10.0. With your feedback, we'll be able to define how to best use our > time, either trying to configure some source code transformation tool to > change TypeScript's output to avoid the problem above [3], creating a > migration tool or just investing in other Tapestry parts if this backward > incompatibility isn't a big deal for your projects. > > Thanks in advance. > > Cheers! > > [1] In other words, the modules supported by browsers using <script > type="module">. See > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules. > > [2] https://github.com/jashkenas/coffeescript/ > > [3] Something like the approach described in this article: > https://www.toptal.com/javascript/write-code-to-rewrite-your-code . > > -- > Thiago H. de Paula Figueiredo > Software developer/engineer > Apache Tapestry consultant, committer and project management committee > member > You can sponsor my work on Tapestry at > https://github.com/sponsors/machina-br > -- Dmitry Gusev AnjLab Team http://anjlab.com
