New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
curlconverter by default consider server root path for 'tree-sitter-bash.wasm' file #617
Comments
There is no way currently, you would have to fork the repo and change these two lines curlconverter/src/shell/webParser.ts Lines 7 to 8 in 112ae7a
to something like await Parser.init({
locateFile(scriptName: string, scriptDirectory: string) {
return '/some/other/path/tree-sitter.wasm';
},
});
const Bash = await Parser.Language.load("/some/other/path/tree-sitter-bash.wasm"); The reason a way to pass these file names hasn't been implemented is so the normal usecase is simpler, you can just do import * as curlconverter from 'curlconverter';
curlconverter.toPython('curl example.com'); instead of having to do import * as curlconverterInit from 'curlconverter';
const curlconverter = curlconverterInit();
curlconverter.toPython('curl example.com'); and there's as little distinction between the native version of the library and the WASM version of the library, the only difference is just this line in package.json Lines 80 to 82 in 112ae7a
|
I'm bumping an old issue here, but the way this is at the moment, it works fine if your website lives at the root of your domain (e.g: https://curlconverter.com ) but if your website lives in a subdirectory (e.g: https://username.github.io/my-static-site ) the library tries to load https://username.github.io/tree-sitter-bash.wasm instead of This makes it impossible to use the library in a site that is deployed to a subdirectory. The other thing I noticed trying to use this in a browser is that although the docs say It would be useful if those two worked the same way, but the inconsistency is less of an issue. |
Dear Team,
Is there any way I could customize the path? Rather than considering the server root path (i.e http://127.0.0.1:8000/tree-sitter-bash.wasm) for
'tree-sitter-bash.wasm
file, is there any possibility that I can specify my customized path? The thing is I don't want to serve that file from the server root path.The text was updated successfully, but these errors were encountered: