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

Esm version of Mockjs #454

Open
wants to merge 65 commits into
base: refactoring
Choose a base branch
from
Open

Esm version of Mockjs #454

wants to merge 65 commits into from

Conversation

KonghaYao
Copy link

这个 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.

@KonghaYao
Copy link
Author

现在已经完善了 node 端的加载了,可以在 node 上使用

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.

2 participants