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

Graph: Remove Node interface #6530

Merged
merged 2 commits into from
Jul 1, 2021
Merged

Conversation

wbinnssmith
Copy link
Contributor

@wbinnssmith wbinnssmith commented Jun 29, 2021

This removes the Node interface and its requirement for Graph values. This makes Graph<T> as generic as Array<T>.

Rather than enforce an id property (which is vestigial and in our use usually reflects a content digest instead of the node's id in the graph) or a type property, users of Graph can use any shape for node values. This type can always be a disjoint union and the user can refine it in their code, but the Graph has never really been aware of the content of its values (nor should it be), so it no longer requires it.

I did not change any of the main AssetGraph, BundleGraph, or RequestGraph node value shapes, which still retain type and id. type should stay to form a disjoint union across the node values, but id should probably be retired in the long term — it's really the content key.

ContentGraph#addNodeByContentKey no longer attempts to replace node values (it throws when a key already exists), and this behavior has been moved to where it has been expected.

Test Plan: yarn test. Adjusted unit tests and removed many of the shapes formerly needed to fulfill these interface requirements.

@height
Copy link

height bot commented Jun 29, 2021

Link Height tasks by mentioning a task ID in the pull request title or description, commit messages, or comments.

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

@wbinnssmith wbinnssmith force-pushed the wbinnssmith/remove-node-interface branch from 2cb8176 to f2a8a92 Compare June 29, 2021 23:27
@parcel-benchmark
Copy link

parcel-benchmark commented Jun 29, 2021

Benchmark Results

Kitchen Sink 🚨

Timings

Description Time Difference
Cold FAILED -0.00ms
Cached FAILED -0.00ms

Cold Bundles

No bundles found, this is probably a failed build...

Cached Bundles

No bundles found, this is probably a failed build...

React HackerNews ✅

Timings

Description Time Difference
Cold 8.52s +109.00ms
Cached 405.00ms -0.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

AtlasKit Editor 🚨

Timings

Description Time Difference
Cold FAILED -0.00ms
Cached FAILED -0.00ms

Cold Bundles

No bundles found, this is probably a failed build...

Cached Bundles

No bundles found, this is probably a failed build...

Three.js ✅

Timings

Description Time Difference
Cold 6.14s +170.00ms
Cached 355.00ms -4.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

Click here to view a detailed benchmark overview.

@wbinnssmith wbinnssmith merged commit cd87329 into v2 Jul 1, 2021
lettertwo added a commit that referenced this pull request Jul 13, 2021
* v2: (34 commits)
  Wrap assets recursively when any incoming dependency is wrapped (#6572)
  Improvements for library targets (#6570)
  Diagnostic for undeclared external dependencies in library builds (#6564)
  More bugs (#6567)
  Don't require `url:` for image transformer (#6565)
  Remove 'Name already registered with serializer' error (#6566)
  Fix live bindings and `this` of external CommonJS modules (#6548)
  JS runtime improvements (#6531)
  Make sure the absolute path isn't contained in the cache (#5900)
  Adds '@parcel/diagnostic' to dependencies (#6563)
  Disable workers with string literals and improve diagnostics (#6536)
  Bug fixes (#6541)
  Don't attempt to resolve URLs starting with '#' (#6504)
  Correctly set worker's output format if not support by environment (#6534)
  Babel: Recognize peerDependencies in isJSX (#6497)
  fix setHeaders ordering on dev server (#6500)
  Graph: Remove Node interface (#6530)
  Fix TS build script for old Node versions (#6526)
  Improve library targets (#6517)
  Fix TypeScript and other sourcemaps by always creating an initial sourcemap (#6472)
  ...
@mischnic mischnic deleted the wbinnssmith/remove-node-interface branch December 21, 2022 17:02
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.

4 participants