Hi Ben, Thanks for your reply and ideas! I did try updating Rhino to the latest version - but it didn't fix the issue directly, I think to take advantage of the newer features an ES6 version flag has to be set, and I haven't had time to try and override that in the tapestry implementation yet. I'll try out the ResourceTransformer option, maybe that will be easier to maintain.
Cheers, Jonathan -----Original Message----- From: Ben Weidig <b...@netzgut.net> Sent: Wednesday, 1 September 2021 10:52 AM To: Tapestry users <users@tapestry.apache.org> Subject: Re: Tapestry and Typescript Hi Jonathan, I haven't worked with TS in 5.7.2 so far, but I tried to look into it. The two issues on Rhino's Github are not very helpful... https://github.com/mozilla/rhino/issues/658 (solved itself somehow) https://github.com/mozilla/rhino/issues/430 (solved with newer Rhino version) Tapestry uses an older Rhino version, have you tried to using the latest one? Not sure if it's compatible though without changes in Tapestry itself, though. Another option would be writing your own ResourceTransformer to compile Typescript yourself using a local TSC instead of typescript.js with Rhino. Maybe someone else has an idea how to integrate Webpack, our JS-setup is rather simple. Cheers, Ben On Wed, Sep 1, 2021 at 9:01 AM Jonathan Luke Shearman <jonathan.shear...@albourne.com.invalid> wrote: > Hello, > > > > First post here and I have a feeling it may not be Tapestry related > but wanted to reach out here just in case! > > > > I recently joined a project that has been maintained for a few years > and is currently using Tapestry 5.7.2 > > Tasked with upgrading some frontend components, I wanted to use > typescript and got it running using the setup in tapestry-webresources > using the Rhino library. > > This worked great on my machine and on the web server, but in the last > week some colleagues needed to work on the same code and discovered > that typescript wasn’t getting transpiled on their local setup. > > > > Rhino complains about a “missing name after the . operator” but > references the typescript.js file at line 1467 (exception at the end > of this message) – ie the file used to transpile the other .ts files > as far as I’ve understood. > ( Please correct me if I’m mistaken) > > I’ve tested this on 8 different colleague machines with only a 50% > success rate unfortunately. We are all running what should be > identical setups, so it’s quite confusing why some don’t work. > > It doesn’t seem to depend on node or tsc command line tools, and > > > > Looking into it, I’m thinking it’s some sort of file reading issue – > there are similar issues on Rhino’s github but unresolved there too. > > A suggested fix was to change every someObject.delete to > someObject[‘delete’] but I don’t think editing typescript.js is the > right solution here. > > The error comes from ‘delete’ being a reserved word in javascript, and > so this is most probably an issue with Rhino’s javascript parser. > > I wondered if anyone has ever come across this issue before or might > have some better ideas on what else to check? > > > > And just as more general question – can anyone recommend a better > setup for handling typescript in Tapestry? My next goal is to bring in > npm packages and potentially work on replacing requireJS with > something like webpack, but I’ve seen on previous threads here that > there’s been limited success? > > I’ve been considering running npm scripts at Tapestry build time to > ‘pre-compile’ all the frontend code in a separate directory and then > hand it back to requireJS by dumping the javascript files into > /modules.. but that feels like overkill. > > > > I’d appreciate any ideas people might have, happy to test anything out > at this point. > > Cheers, > > Jonathan > > > > > > Original Exception: > > Exception: org.apache.tapestry5.ioc.internal.OperationException > > Message: missing name after . operator > (classpath:org/apache/tapestry5/webresources/internal/typescript.js#14 > 67) > > trace: Streaming compressed module custom-file > > Streaming > classpath:META-INF/modules/custom-file.ts > (compressed) > > Compiling > classpath:META-INF/modules/custom-file.ts > from > TS to JavaScript > > Creating Rhino executor for source(s) > classpath:org/apache/tapestry5/webresources/internal/typescript.js, > classpath:org/apache/tapestry5/webresources/internal/invoke-typescript.js. > > Loading script > classpath:org/apache/tapestry5/webresources/internal/typescript.js. > > Exception: org.mozilla.javascript.EvaluatorException > > Message: missing name after . operator > (classpath:org/apache/tapestry5/webresources/internal/typescript.js#14 > 67) > > columnNumber: 37 > > lineNumber: 1467 > > lineSource: class_1.prototype.delete = function (key) > { > > scriptStackTrace: > > sourceName: > classpath:org/apache/tapestry5/webresources/internal/typescript.js > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org