Make JS engines optional dependencies when pulling in gost-dom/browser#245
Make JS engines optional dependencies when pulling in gost-dom/browser#245tomlinford wants to merge 1 commit intogost-dom:mainfrom
Conversation
WalkthroughThis pull request restructures JavaScript engine dependencies by moving them from the main module into separate optional sub-modules. The main go.mod removes direct dependencies on v8go and Sobek, while new go.mod files are introduced for scripting/v8engine, scripting/sobekengine, and v8browser that declare these dependencies independently. Documentation is expanded to describe the available engine options and usage instructions. The internal/test/wpt module adds a v8engine dependency. This change isolates heavy engine-specific dependencies into optional packages. Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
README_SCRIPT_ENGINE.md (1)
114-114: Fix typo in link reference.The link reference should be
[Sobek]not[Sobak]to match the project name.Proposed fix
-[Sobak]: https://github.com/grafana/sobek +[Sobek]: https://github.com/grafana/sobek
| There are two script engines available: | ||
|
|
||
| - `github.com/gost-dom/browser/scripting/v8engine` - Uses V8 | ||
| - `github.com/gost-dom/browser/scripting/sobekengine` - Pure Go JavaScript engine |
There was a problem hiding this comment.
Fix trailing space.
Proposed fix
-- `github.com/gost-dom/browser/scripting/sobekengine` - Pure Go JavaScript engine
+- `github.com/gost-dom/browser/scripting/sobekengine` - Pure Go JavaScript engine📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - `github.com/gost-dom/browser/scripting/sobekengine` - Pure Go JavaScript engine | |
| - `github.com/gost-dom/browser/scripting/sobekengine` - Pure Go JavaScript engine |
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
71-71: Trailing spaces
Expected: 0 or 2; Actual: 1
(MD009, no-trailing-spaces)
|
Hey. Thanks for contributing this. I have been aware of the problem. I ultimately had a different solution in mind: The script engines are moved to their own git repository, i.e. However, the interface is still in changing, and kept in I was a bit reluctant to this change at first; as I have previously learned of others having bad experiences with nested modules. But it could appear that the complaints were either unjust or just outdated. I know I had nested modules already; but they were internal tools never intended for user consumption; and I created Versioning?This change turns one go module into 3 go modules; but there's only one build/version script, as well as a single CHANGELOG. From what I can tell, Go supports tagging version tags for submodules, e.g. Would it make sense to have separate versioning of the submodules? You mention AWS SDK v2 as an example. How do they handle submodule versioning? Regarding build scriptsBuild/versioning uses JavaScript tools for no other reason than I already knew these tools. I'd be more than happy to replace those with native Go tools if that makes sense. |
|
Hi, I think your long term plan makes sense. Also feel free to just reject this PR if you'd prefer, we're using this change locally and just handled it with a replace directive in go.mod. Considering how many tags the AWS Go SDK v2 repo has, I have to imagine it's pretty heavily scripted. It looks like there's a root tagged version and then also tags for each of the individual services, and those tags are just the path to the module. It doesn't seem like they try to ensure that the versions are aligned across the different services. One approach too would be to simplify things a bit and only have the v8 engine as a separate submodule -- pulling in a pure go js engine probably wouldn't be too bad for the typical consumer of the library. |
|
I'm doing a lot of work in the JS engine at the moment, as I am working on But an issue was reported on v8go which uses submodules (to solve a different problem). In v8go, vendoring doesn't work. I'm not sure if I understand the diagnosis correctly, but it appears that vendoring doesn't work with submodules. |
Right now pulling in gost-dom/browser also adds v8 engine as a dependency, which is pretty heavy. This change lets API consumer pick which JS engine to use, if any.