Remove NetsTool and nets dependency#113
Merged
adroitwhiz merged 1 commit intoscratchfoundation:developfrom Jun 2, 2020
Merged
Conversation
8aa5ad3 to
cdc6ad1
Compare
cdc6ad1 to
7f62d23
Compare
Contributor
|
Testing: load and save projects in many browsers |
Contributor
|
🎉 This PR is included in version 1.3.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
This PR removes
NetsTooland the dependency on thenetspackage.Reason for Changes
Regardless of whether it's running in Node or the browser,

netspulls in both therequestlibrary (which is in maintenance mode) and thexhrlibrary. Both have many dependencies that add around ~100kb to the bundle size:These include, but are not limited to, 13 different packages depended upon by a polyfill for
String.prototype.trim, a function which is supported in all browsers released in the last 7 years.According to MDN, the Fetch API is supported on all browsers that Scratch targets, making the

netsfallback unnecessary:To retain Node support (e.g. for running tests), I have added
node-fetch, an implementation of the Fetch API for Node, as a dev-only dependency.I also have a branch which removes the
netsdependency from scratch-vm, but I don't want to submit that until you approve of this one to avoid submitting too many potentially unwanted PRs.Test Coverage
Testing will have to be manually done across browsers.