Skip to content
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

How to run big scripts? #609

Closed
arivera12 opened this issue Mar 6, 2019 · 35 comments
Closed

How to run big scripts? #609

arivera12 opened this issue Mar 6, 2019 · 35 comments

Comments

@arivera12
Copy link

arivera12 commented Mar 6, 2019

Hi,

I am making pdfmake wrapper on c# but I get object reference not set into an object when trying to execute this lib. The minified script version is about 1.04 MB. Is there any limitation on the size of script?
image

@lahma
Copy link
Collaborator

lahma commented Mar 7, 2019

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.

@arivera12
Copy link
Author

arivera12 commented Mar 7, 2019

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!

@lahma
Copy link
Collaborator

lahma commented Mar 7, 2019

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.

@arivera12
Copy link
Author

arivera12 commented Mar 7, 2019

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.

@arivera12
Copy link
Author

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.

@arivera12
Copy link
Author

I just updated to version 3.0.0-beta-1353 and I am getting a different error.
image

@lahma
Copy link
Collaborator

lahma commented Mar 8, 2019

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

@arivera12
Copy link
Author

Thanks for the update. I will keep looking forward on this until its gets fixed/implemented. Please keep me updated about this! Thanks.

@arivera12
Copy link
Author

any update?

@arivera12
Copy link
Author

@lahma any good news?

@lahma
Copy link
Collaborator

lahma commented Jul 5, 2019

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.

@arivera12
Copy link
Author

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.

@arivera12
Copy link
Author

Hey @lahma any new update?

@lahma
Copy link
Collaborator

lahma commented May 24, 2020

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.

@arivera12
Copy link
Author

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.

@lahma
Copy link
Collaborator

lahma commented Dec 11, 2020

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.

@lahma lahma closed this as completed Dec 11, 2020
@arivera12
Copy link
Author

I will update a give it a try a lot of time has pass.

@lahma
Copy link
Collaborator

lahma commented Jul 17, 2021

@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.

@arivera12
Copy link
Author

I will @lahma

@arivera12
Copy link
Author

I got this error @lahma
image

@arivera12
Copy link
Author

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.

@lahma
Copy link
Collaborator

lahma commented Jul 18, 2021

What about the MyGet feed? It's not on nuget.org yet.

@arivera12
Copy link
Author

How can I get from there? I have never tried or used my get feed...

@arivera12
Copy link
Author

let me quick google the cmd for this

@arivera12
Copy link
Author

Ok I updated to 3.0.0-beta-2083 and still fails with the same error.

@arivera12
Copy link
Author

are Uint16Array implemented already?

@lahma
Copy link
Collaborator

lahma commented Jul 18, 2021

@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.

@arivera12
Copy link
Author

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.

@arivera12
Copy link
Author

If you have a newly updated package let me know to retry.

@lahma
Copy link
Collaborator

lahma commented Jul 18, 2021

3.0.0-beta-2033 from NuGet should be the one to use.

@arivera12
Copy link
Author

arivera12 commented Jul 19, 2021

@lahma let me retry with that version if I can install it

@arivera12
Copy link
Author

@lahma! It almost runs!

image

@arivera12
Copy link
Author

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.

@arivera12
Copy link
Author

arivera12 commented Jul 22, 2021

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.

@lahma
Copy link
Collaborator

lahma commented Jul 22, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants