How to run big scripts?
Closed this issue ยท 35 comments
It seems you've probably hit both missing ES6 functionality and internal bugs of Jint. We can start by fixing the obvious bugs and check how far that goes. Thanks for the example, it seems to be treasure trove for cases not covered.
Well, This lib supposed to be compiled into es5 script features they are using webpack. I have read the code and I don't see any es6 functionality in what I have read in the source, it seems to be es5 features only. So I think there may be some bugs of jint instead.
This is so sad for me I have implemented like %90 of the features of this lib already on c# and was trying to execute some different methods available that needs js interop. Well anyway I will wait for it to see if gets fixed in the meantime I will do some other approach for the js interop need using the browser.
PS. Jint is awesome!
Quick look at the problems showed that many should be quite easily fixable. Script also tries to find Uint8Array
and Uint16Array
, but it seems to have workarounds when they are not present.
This lib implements on its owns some browser missing dependencies and works has a standalone lib. Not sure if they are using any other external lib on newer versions, it doesn't seems to be. I have used this lib for many years and I have not found any problems yet.
Uint8Array seems to have a workaround using try and catch to check if implementation exists in the context, for Uint16Array they asume this feature exists already.
I worked on the issues yesterday evening and was able to get most of the things working, but script indeed seems to require Uint16Array
, typed arrays are currently not implemented yet.
There should be a new release on NuGet quite soon which fixes the issue you are seeing, You can also tune into the dev feed which is updated more frequently by using NuGet.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="Jint" value="https://www.myget.org/F/jint/api/v3/index.json" />
</packageSources>
<disabledPackageSources />
</configuration>
Current state can be seen on this branch: https://github.com/lahma/jint/tree/fix-issues-with-pdfmake
Thanks for the update. I will keep looking forward on this until its gets fixed/implemented. Please keep me updated about this! Thanks.
any update?
Sorry, I've been busy with other things. One thing that would help this effort if you would like to look into implementing the typed arrays functionality.
I would need to take a brief of the code by someone and see how it works then I could help into trying to implement such of feature.
I think still requires the aforementioned things. Could you try out doing a PR for say ArrayBuffer functionality? You can try to se shims for DataView, ArrayBuffer etc, but I was unable to get the required pieces together.
I haven't got any free time to engage into this proyect! Sadly, I currently maintaining 8 other projects atm but I am very interested on this one. Just wanted to know what things are still missing I will still be watching this project over time, please keep me updated if there is any news. Mention me at any time.
I'm closing this as probably more fine-grained issues would make sense. There's a lot here and PRs towards supporting various features would make more sense.
I will update a give it a try a lot of time has pass.
@arivera12 if you have time. please try latest main from MyGet feed and see if your problems have been solved. ArrayBuffer, DataView and typed arrays have been implemented.
Sorry for the past posts, there was a pre release version 3.0.0-beta-2032 which I updated to and I tried it again but got the same error as well.
What about the MyGet feed? It's not on nuget.org yet.
How can I get from there? I have never tried or used my get feed...
let me quick google the cmd for this
Ok I updated to 3.0.0-beta-2083 and still fails with the same error.
are Uint16Array
implemented already?
@arivera12 sorry, I think the MyGet publish isn't working with the new GitHub actions yet. There should now be a new release 3.0.0-beta-2033 available on NuGet.
I tried the version on nuget which points to 3.0.0-beta-2032 and also tried the one from myget 3.0.0-beta-2083 and still the same error.
If you have a newly updated package let me know to retry.
3.0.0-beta-2033 from NuGet should be the one to use.
This library for some things is using navigator and then user agent which is are properties and/or objects that exists in the browser context rather than JavaScript Itself. I know if this library makes a branch removing all browser context objects this library should work out of the box without any issues.
Maybe an option would be emulating that the window, window.navigator objects exists and so on. I will try to work around it! I will update soon when have a little more time.
Great, seems that you probably are unblocked from Jint's side. Now it's more like finding the ways to inject needed things to ensure non-browser code path will work.