parse-community / Parse-SDK-JS

The JavaScript SDK for Parse Platform
https://parseplatform.org
Apache License 2.0
1.32k stars 596 forks source link

fix: Remove circular dependencies #2125

Closed dplewis closed 3 months ago

dplewis commented 3 months ago

Pull Request

Issue

The SDK has circular dependencies, require cycles are allowed, but can result in uninitialized values. This prevents the SDK from moving to ES6 for tree-shaking and full Typescript support.

1) ParseACL.js > ParseRole.js
2) ParseObject.js > ParseACL.js > ParseRole.js
3) ParseUser.js > ParseObject.js > ParseACL.js
4) ParseObject.js > ParseOp.js
5) ParseObject.js > ParseOp.js > ParseRelation.js
6) ParseOp.js > ParseRelation.js
7) ParseObject.js > ParseOp.js > ParseRelation.js > ParseQuery.js > OfflineQuery.js > decode.js
8) ParseOp.js > ParseRelation.js > ParseQuery.js > OfflineQuery.js > decode.js
9) ParseRelation.js > ParseQuery.js > OfflineQuery.js > decode.js
10) ParseObject.js > ParseOp.js > ParseRelation.js > ParseQuery.js > OfflineQuery.js > equals.js
11) ParseObject.js > ParseOp.js > ParseRelation.js > ParseQuery.js
12) ParseOp.js > ParseRelation.js > ParseQuery.js > encode.js
13) ParseRelation.js > ParseQuery.js > encode.js
14) ParseObject.js > ParseOp.js > arrayContainsObject.js
15) ParseObject.js > SingleInstanceStateController.js
16) uuid.js

Closes: https://github.com/parse-community/Parse-SDK-JS/issues/1448

Approach

Shoutout to @swittk for coming up with the idea and testing it out.

Tasks

parse-github-assistant[bot] commented 3 months ago

Thanks for opening this pull request!

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (72bc9ac) to head (523bb8b). Report is 24 commits behind head on alpha.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## alpha #2125 +/- ## =========================================== + Coverage 99.98% 100.00% +0.01% =========================================== Files 61 64 +3 Lines 6185 6327 +142 Branches 1499 1506 +7 =========================================== + Hits 6184 6327 +143 + Misses 1 0 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

dplewis commented 3 months ago

There is a check circular job on Parse Server but not in the SDK.

parseplatformorg commented 3 months ago

🎉 This change has been released in version 5.1.0-alpha.10

parseplatformorg commented 3 months ago

🎉 This change has been released in version 5.1.0-beta.1

parseplatformorg commented 3 months ago

🎉 This change has been released in version 5.1.0