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

Upgraded to Jint v3 #89

Merged
merged 4 commits into from
Mar 1, 2024

Conversation

tomvanenckevort
Copy link
Contributor

Types of Changes

Prerequisites

Please make sure you can check the following two boxes:

  • I have read the CONTRIBUTING document
  • My code follows the code style of this project

Contribution Type

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue, please reference the issue id)
  • New feature (non-breaking change which adds functionality, make sure to open an associated issue first)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Description

As discussed in #84 this PR is to cover the upgrade of AngleSharp.Js to use Jint v3.

Changes made:

  • Upgraded Nuget package reference of Jint to v3.0.0.
  • Changed target framework of project to .NET Standard 2.0 and .NET Framework 4.6.2 to match the Jint v3 targets.
  • Updated Jint namespaces and class names (e.g. FunctionInstance > Function) to match the changes made in Jint v3.
  • Updated EngineInstance to remove the lexical and variable environments since those are no longer public in Jint v3. Instead there is now a global window object which also gets exposed on the global object (to ensure that things like window.location.href and location.href resolve to the same thing).
  • Replaced ConsoleInstance with a new Console class that ties it directly to the Window object (as per JS spec).
  • Removed obsolete classes that have been replaced by Jint equivalents (e.g. DomDelegateInstance > ClrFunction).
  • Checked that all existing unit tests are passing, and added a new ECMA test class. I've only added a single test in there to check that loading an ECMA script succeeds, but feel free to suggest any other tests required.

Also a shoutout to @lahma for providing some guidance and older test code that helped me figure out the global object changes. 👍

@CLAassistant
Copy link

CLAassistant commented Feb 28, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@FlorianRappl FlorianRappl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is superb - you are officially a rockstar 🚀 !

What are you plans with this? How should we proceed to bring this live?

@@ -22,7 +22,7 @@

<ItemGroup>
<PackageReference Include="AngleSharp" Version="0.15.0" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The big question is - should we make this AngleSharp 1.0.0 compatible?

We can also first release it for an older version and then upgrade it (making it also a 1.0.0).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to target AngleSharp 1.0.0 and then make this a v1.0.0 as well.
I'll make those changes and update my PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about target frameworks? I notice that for AngleSharp v1 you target netstandard2.0;net461;net472;net6.0;net7.0;net8.0.
Should we aim for the same on this project?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aim yes, but generally libs don't need to have the same scope, e.g., AngleSharp.Io has a few things that require "more" capabilities - so it is not as general.

Appreciated that you take the update!

@FlorianRappl
Copy link
Contributor

Also another question - what about #87 ? Should we bring this in (the test and fix, if that still applies)?

@FlorianRappl FlorianRappl linked an issue Feb 28, 2024 that may be closed by this pull request
@FlorianRappl FlorianRappl added this to the v1.0 milestone Feb 28, 2024
@tomvanenckevort
Copy link
Contributor Author

I think #87 should be merged in devel first since it's been around for a while, and then I can rebase my branch on that one to ensure my changes work with that fix.

@FlorianRappl
Copy link
Contributor

FlorianRappl commented Feb 29, 2024

Merged #87 into devel. Thanks for taking this and putting in the effort @tomvanenckevort !

Copy link
Contributor

@FlorianRappl FlorianRappl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome to me. Let's have the build green and have the first pre-release done.

@FlorianRappl FlorianRappl merged commit b605b4f into AngleSharp:devel Mar 1, 2024
5 checks passed
@tomvanenckevort
Copy link
Contributor Author

We're note quite there yet.
I ran some extra tests locally yesterday and realised that the <script type="module"> tags currently don't work. So I need to have another look at that one.
But I guess we can handle that via another PR :)

@FlorianRappl
Copy link
Contributor

Yes, I mean it's anyway just a first preview. I've assigned some / relevant issues to the v1 milestone.

I am not sure yet how much I can look into them tonight and on the weekend, but my goal would be to have a bit of focus now on AngleSharp.Js to have this as a 1.0.0. Thanks for your PR and motivating me to do so.

If you want to pick up / anyway have some of these issues handled then please comment on them. Otherwise I'll just pick up whatever is left.

@FlorianRappl
Copy link
Contributor

Preview is out (https://www.nuget.org/packages/AngleSharp.Js/0.15.0-beta.16).

The version is still placed at 0.15 and I also noticed that some parts of the NuGet package definition (e.g., the README) are missing: I'll add those and push to devel.

@tomvanenckevort tomvanenckevort mentioned this pull request Mar 1, 2024
9 tasks
@lahma
Copy link
Contributor

lahma commented Mar 1, 2024

Awesome work @tomvanenckevort ! I'll hopefully have some timesoon too to check this out and investigate if there's something that Jint could improve too. Just have to get back from vacation first 😄

@FlorianRappl
Copy link
Contributor

FlorianRappl commented Mar 1, 2024

Preview is out (https://www.nuget.org/packages/AngleSharp.Js/1.0.0-beta.20); incl. latest target frameworks, correct reference to Jint and AngleSharp, README etc.

I think from the infrastructure POV we are done, now we "only" need to clear the outstanding issues and have it (draw the rest of the owl).

How to draw an owl

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

Successfully merging this pull request may close these issues.

Migration to Jint v3
4 participants