Skip to content

Commit a4705c1

Browse files
Fix sync-actions package not working on a browser environment (#1927)
* fix(sync-actions): fix issue with the jsondiffpath dependency * chore: add changeset
1 parent dc69426 commit a4705c1

File tree

4 files changed

+38
-62
lines changed

4 files changed

+38
-62
lines changed

.changeset/dull-chefs-call.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@commercetools/sync-actions': patch
3+
---
4+
5+
We found an issue in the way the `jsondiffpatch` was used that made this package not usable in a browser environment.
6+
7+
In this version we adjust the way that package is imported and we pin a transitive dependency (`chalk`) to fix the error.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
"diff": "5.0.0",
134134
"object-path": "0.11.8",
135135
"npm": "6.14.17",
136-
"set-value": "4.0.1"
136+
"set-value": "4.0.1",
137+
"chalk": "3.0.0"
137138
}
138139
}

packages/sync-actions/src/utils/diffpatcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DiffPatcher } from 'jsondiffpatch'
1+
import { DiffPatcher } from 'jsondiffpatch/dist/jsondiffpatch.cjs'
22

33
export function objectHash(obj, index) {
44
const objIndex = `$$index:${index}`

yarn.lock

Lines changed: 28 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,23 @@
13501350
resolved "https://registry.yarnpkg.com/@commercetools/sdk-middleware-logger/-/sdk-middleware-logger-2.1.2.tgz#6b8ce77699bf5d8e5ec4f243a2c9d691094ef0c7"
13511351
integrity sha512-uGhhAUnZzLWO3ozzz6VDMUAKr5Y9ctVyqfExXVC7t37IgppLsKrrvLl6VMoU2uXjIGSNA0VN0Kxgj93rBBejTQ==
13521352

1353+
"@commercetools/sync-actions@^5.0.0":
1354+
version "5.19.2"
1355+
resolved "https://registry.yarnpkg.com/@commercetools/sync-actions/-/sync-actions-5.19.2.tgz#93cf5bd624feeabe56517299b3c54b13593eb906"
1356+
integrity sha512-9CrqaSxhZ2+TIcfr1Jvatj1Mme85rYkWtcAevrA/wqYbTkU095hQMHu1cIJ3vH4zkKXtq6ORL0k1DXVLgy8lXA==
1357+
dependencies:
1358+
fast-equals "^2.0.0"
1359+
jsondiffpatch "^0.4.0"
1360+
lodash.flatten "^4.4.0"
1361+
lodash.foreach "^4.5.0"
1362+
lodash.intersection "^4.4.0"
1363+
lodash.isequal "^4.5.0"
1364+
lodash.isnil "^4.0.0"
1365+
lodash.shuffle "^4.2.0"
1366+
lodash.sortby "^4.7.0"
1367+
lodash.uniqwith "^4.5.0"
1368+
lodash.without "^4.4.0"
1369+
13531370
"@commitlint/[email protected]":
13541371
version "12.1.4"
13551372
resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-12.1.4.tgz#af4d9dd3c0122c7b39a61fa1cd2abbad0422dbe0"
@@ -3413,12 +3430,7 @@ ansi-strikethrough@^0.1.1:
34133430
dependencies:
34143431
ansi-wrap "0.1.0"
34153432

3416-
ansi-styles@^2.2.1:
3417-
version "2.2.1"
3418-
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
3419-
integrity sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==
3420-
3421-
ansi-styles@^3.2.0, ansi-styles@^3.2.1:
3433+
ansi-styles@^3.2.0:
34223434
version "3.2.1"
34233435
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
34243436
integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==
@@ -4507,47 +4519,14 @@ chainsaw@~0.1.0:
45074519
dependencies:
45084520
traverse ">=0.3.0 <0.4"
45094521

4510-
[email protected], chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.4.1, chalk@^2.4.2:
4511-
version "2.4.2"
4512-
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
4513-
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
4514-
dependencies:
4515-
ansi-styles "^3.2.1"
4516-
escape-string-regexp "^1.0.5"
4517-
supports-color "^5.3.0"
4518-
4519-
chalk@^1.1.3:
4520-
version "1.1.3"
4521-
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
4522-
integrity sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==
4523-
dependencies:
4524-
ansi-styles "^2.2.1"
4525-
escape-string-regexp "^1.0.2"
4526-
has-ansi "^2.0.0"
4527-
strip-ansi "^3.0.0"
4528-
supports-color "^2.0.0"
4529-
4530-
chalk@^3.0.0:
4522+
[email protected], [email protected], chalk@^1.1.3, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.4.1, chalk@^2.4.2, chalk@^3.0.0, chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1, chalk@^5.3.0:
45314523
version "3.0.0"
45324524
resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4"
45334525
integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==
45344526
dependencies:
45354527
ansi-styles "^4.1.0"
45364528
supports-color "^7.1.0"
45374529

4538-
chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1:
4539-
version "4.1.2"
4540-
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
4541-
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
4542-
dependencies:
4543-
ansi-styles "^4.1.0"
4544-
supports-color "^7.1.0"
4545-
4546-
chalk@^5.3.0:
4547-
version "5.3.0"
4548-
resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385"
4549-
integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==
4550-
45514530
char-regex@^1.0.2:
45524531
version "1.0.2"
45534532
resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf"
@@ -6143,7 +6122,7 @@ escalade@^3.1.1, escalade@^3.1.2:
61436122
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27"
61446123
integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==
61456124

6146-
[email protected], escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
6125+
[email protected], escape-string-regexp@^1.0.5:
61476126
version "1.0.5"
61486127
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
61496128
integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==
@@ -7621,13 +7600,6 @@ hard-rejection@^2.1.0:
76217600
resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883"
76227601
integrity sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==
76237602

7624-
has-ansi@^2.0.0:
7625-
version "2.0.0"
7626-
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
7627-
integrity sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==
7628-
dependencies:
7629-
ansi-regex "^2.0.0"
7630-
76317603
has-bigints@^1.0.1, has-bigints@^1.0.2:
76327604
version "1.0.2"
76337605
resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa"
@@ -9290,6 +9262,14 @@ [email protected]:
92909262
chalk "^2.3.0"
92919263
diff-match-patch "^1.0.0"
92929264

9265+
jsondiffpatch@^0.4.0:
9266+
version "0.4.1"
9267+
resolved "https://registry.yarnpkg.com/jsondiffpatch/-/jsondiffpatch-0.4.1.tgz#9fb085036767f03534ebd46dcd841df6070c5773"
9268+
integrity sha512-t0etAxTUk1w5MYdNOkZBZ8rvYYN5iL+2dHCCx/DpkFm/bW28M6y5nUS83D4XdZiHy35Fpaw6LBb+F88fHZnVCw==
9269+
dependencies:
9270+
chalk "^2.3.0"
9271+
diff-match-patch "^1.0.0"
9272+
92939273
jsonfile@^4.0.0:
92949274
version "4.0.0"
92959275
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
@@ -13923,18 +13903,6 @@ [email protected]:
1392313903
dependencies:
1392413904
has-flag "^1.0.0"
1392513905

13926-
supports-color@^2.0.0:
13927-
version "2.0.0"
13928-
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
13929-
integrity sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==
13930-
13931-
supports-color@^5.3.0:
13932-
version "5.5.0"
13933-
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
13934-
integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==
13935-
dependencies:
13936-
has-flag "^3.0.0"
13937-
1393813906
supports-color@^6.1.0:
1393913907
version "6.1.0"
1394013908
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.1.0.tgz#0764abc69c63d5ac842dd4867e8d025e880df8f3"

0 commit comments

Comments
 (0)