Skip to content

Conversation

@Yuyz0112
Copy link
Member

@Yuyz0112 Yuyz0112 commented Jun 12, 2022

Previously, there were two parts of code in the rrdom package:

  1. The general virtual DOM implementation.
  2. The polyfill code helps build the virtual DOM to run in NodeJS(without browser support).

Mixing these codes in one package cause some problems, the most obvious one is we need to import from rrdom/es/virtual-dom to make sure we will not import NodeJS-related code.

Although it works, it left some tricky config code and is not friendly to bundle tools and monorepo tools.

So in this PR, I move the general implementation to a new package rrdom, and rename the original rrdom to rrdom-nodejs. The dependency relations become:

flowchart TB
    rrdom --> rrweb
    rrdom --> rrdom-nodejs
Loading

@Yuyz0112 Yuyz0112 requested review from Juice10 and YunFeng0817 June 12, 2022 08:49
@Yuyz0112 Yuyz0112 force-pushed the yanzhen-patch branch 2 times, most recently from 2bd6d9e to 7825edd Compare June 12, 2022 08:57
Copy link
Member

@YunFeng0817 YunFeng0817 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 a great refactor! My only concern is the name 'vdom', cause there is already a package in the npmjs's repositories. https://www.npmjs.com/package/vdom
I'm not sure whether our package still can be published or not.

@Yuyz0112 Yuyz0112 force-pushed the yanzhen-patch branch 3 times, most recently from f78cf0d to 18dcefb Compare June 12, 2022 14:44
@Yuyz0112
Copy link
Member Author

@Mark-Fenng Yes, this is just a proposal, and I can refactor it.

I think there are two strategies:

  1. rename vdom to rrdom, and rename rrdom to rrdom-nodejs
  2. keep the naming and never publish vdom package to the registry, just use it as an internal package

@Juice10
Copy link
Member

Juice10 commented Jun 12, 2022

The rrdom and rrdom-nodejs proposal "feels" better to me but I don't really have a good rational argument for this argument over the other.

This PR looks great, thanks for taking the time to break this apart! This makes building a lot cleaner, and reduces circular dependencies.

I understand the confusion with BaseRRNode, I'm not sure I totally understand when to use it myself. But it makes sense to keep the imports what they where and not change them

@YunFeng0817
Copy link
Member

I also prefer the first strategy because it feels more intuitive.

@Yuyz0112 Yuyz0112 force-pushed the yanzhen-patch branch 4 times, most recently from 94738bb to 8b93765 Compare June 19, 2022 12:37
@Yuyz0112
Copy link
Member Author

@Mark-Fenng @Juice10 I've updated this PR.

Copy link
Member

@Juice10 Juice10 left a comment

Choose a reason for hiding this comment

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

Great stuff @Yuyz0112!

Copy link
Member

@YunFeng0817 YunFeng0817 left a comment

Choose a reason for hiding this comment

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

great work!

@Yuyz0112
Copy link
Member Author

let's merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants