-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Esm version of Mockjs #454
Open
KonghaYao
wants to merge
65
commits into
nuysoft:refactoring
Choose a base branch
from
KonghaYao:esm
base: refactoring
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
现在已经完善了 node 端的加载了,可以在 node 上使用 |
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.
这个 esm 模块分割版本的 Mockjs 是我的重构版本。
我对 Mockjs 的大部分模块引用进行了更改,然后添加了如 对 fetch 的代理覆盖等新功能,但是原来 Mockjs 的 API 完全没有改变!
现在这个项目以 mockjs-esm 发布到 npm 中,开发者可以直接替换相应的导入路径,但是不保证有些重构时的小 BUG 的存在。
说实话,mockjs 是一个非常棒的库,很多的 API 对后面的模拟数据库产生了深源的影响,这也是我想要对 mockjs 进行 esm 重构的原因。
重构的时候发现原作者的功底是很深厚的,在没有模块化的代码的同时,借鉴 jQuery 的写法写出了 mockjs 这个库。
但是 esm 的模块化简化了很多逻辑,对于项目管理更加有利,所以我用了一个月的时间进行代码的重构。
最后,感谢作者对开源社区所作的重大贡献。
English Tanslate
Mockjs is my refactoring version.
I changed most of the module references of mockjs, and then added new functions such as proxy overlay to fetch, but the original mockjs API has not changed at all!
Now this project is published to NPM as mockjs ESM. Developers can directly replace the corresponding import path, but it does not guarantee the existence of some small bugs during refactoring.
To be honest, mockjs is a very good library. Many APIs have a deep impact on the simulation database. This is why I want to refactor mockjs with ESM.
When refactoring, I found that the original author's foundation is very deep. Without modular code, I wrote mockjs library with reference to jQuery.
But the modularization of ESM simplifies a lot of logic, which is more beneficial for project management, so I spent a month refactoring the code.
Finally, I would like to thank the author for his great contribution to the open source community.