Conversation
| if [ $? -eq 0 ]; then | ||
| rsync -avq docs/site/home target/site --exclude template | ||
| rsync -avq docs/gremlint/dist/ target/site/home/gremlint | ||
| rsync -avq docs/gremlator/build/ target/site/home/gremlator |
There was a problem hiding this comment.
| rsync -avq docs/gremlator/build/ target/site/home/gremlator | |
| rsync -avq docs/gremlator/dist/ target/site/home/gremlator |
There was a problem hiding this comment.
not sure what happened there. thought i purposely changed that to build after dist didn't work but now i see it doesn't work with build....
| else | ||
| cp -R docs/site/home target/site | ||
| cp -R docs/gremlint/dist/. target/site/home/gremlint | ||
| cp -R docs/gremlator/build/. target/site/home/gremlator |
There was a problem hiding this comment.
| cp -R docs/gremlator/build/. target/site/home/gremlator | |
| cp -R docs/gremlator/dist/. target/site/home/gremlator |
|
|
||
| export default defineConfig({ | ||
| plugins: [react()], | ||
| base: '/gremlator', |
There was a problem hiding this comment.
| base: '/gremlator', | |
| base: '/gremlator', | |
| esbuild: { | |
| keepNames: true, | |
| }, |
In local testing, I was noticing that step arguments seemed to just pass straight through without any translation.
My AI overlord of choice had this to say about it, resulting in this fix:
The TranslateVisitor.visit() method dispatches to the correct visitor method (e.g. visitStringLiteral, visitIntegerLiteral) by inspecting tree.constructor.name at runtime — it expects names like StringLiteralContext and strips the Context suffix to find the method.
Vite's production build minifies class names, so StringLiteralContext becomes something like Qh. The className.endsWith('Context') check fails, the dispatch never matches any specific visitor method, and every rule context falls through to the generic visitChildren() path, which just walks down to terminal
tokens and outputs raw text.That's why step names translate correctly (they're terminal tokens handled by visitTerminal) but all arguments — strings, numbers, booleans, collections — pass through unmodified. The language-specific visitor overrides for those literal types never get called.
The fix is adding esbuild: { keepNames: true } to vite.config.ts so class names survive minification. But the deeper issue is in gremlin-js itself: the visit() dispatch relies on runtime class name reflection, which is inherently fragile under minification. A more robust approach would be to dispatch on
ruleIndex (a stable integer) rather than the class name string.
That is quite an unexpected failure mode in my opinion. It does give me some concerns about the frailty of the JS translators in embedded webapp deployments (which is their intended purpose).
I don't think the translator fragility is of concern for this PR, but it's something to think about going forward.
There was a problem hiding this comment.
New React+TypeScript single-page application under docs/gremlator/ that translates canonical Gremlin input into 8 target languages (Canonical, JavaScript, Python, Go, .NET, Java, Groovy, Anonymized) using GremlinTranslator from gremlin-javascript. Purely browser-based; no backend required. Also updates bin/generate-home.sh to build and deploy gremlator alongside gremlint via the existing Apache SVN publish pipeline.
|
VOTE +1 |
| "eslint-plugin-prettier": "^5.0.0", | ||
| "globals": "^15.14.0", | ||
| "js-yaml": "^3.14.2", | ||
| "jsdoc": "^4.0.5", |
There was a problem hiding this comment.
Nit: leaked dependency addition?
|
VOTE +1 |
Introducing Gremlator in its javascript only form. This is a port of the prototype application currently running at https://gremlator.com and built by @bechbd