DEV: Replace virtual-dom fork with patch-package (#21007)
Using patch-package is much easier to reason with than maintaining a full fork of virtual-dom. Original reasoning for the fork can be found ine216a98f
Patch is based on the diff atc64007150a (diff-f648eb0588a88af826e29622f64aca611e191c66eb9e79396d559edaef622313)
This commit is contained in:
parent
76874b7098
commit
e2f65cd170
|
@ -36,9 +36,6 @@ module.exports = function (defaults) {
|
|||
enabled: true,
|
||||
},
|
||||
autoImport: {
|
||||
alias: {
|
||||
"virtual-dom": "@discourse/virtual-dom",
|
||||
},
|
||||
forbidEval: true,
|
||||
insertScriptsAt: "ember-auto-import-scripts",
|
||||
webpack: {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
"@babel/standalone": "^7.21.4",
|
||||
"@discourse/backburner.js": "^2.7.1-0",
|
||||
"@discourse/itsatrap": "^2.0.10",
|
||||
"@discourse/virtual-dom": "^2.1.2-0",
|
||||
"@ember-compat/tracked-built-ins": "^0.9.1",
|
||||
"@ember/jquery": "^2.0.0",
|
||||
"@ember/legacy-built-in-components": "^0.4.2",
|
||||
|
@ -99,6 +98,7 @@
|
|||
"tippy.js": "^6.3.7",
|
||||
"util": "^0.12.5",
|
||||
"webpack": "^5.79.0",
|
||||
"virtual-dom": "^2.1.1",
|
||||
"wizard": "1.0.0",
|
||||
"xss": "^1.0.14"
|
||||
},
|
||||
|
|
|
@ -22,9 +22,12 @@
|
|||
"resolutions": {
|
||||
"**/babel-plugin-debug-macros": "npm:@discourse/babel-plugin-debug-macros@0.4.0-pre1"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"dependencies": {
|
||||
"patch-package": "^6.5.1",
|
||||
"postinstall-postinstall": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"notes": {
|
||||
"deps vs devDeps": "this project doesn't use dev dependencies when building the app, so all dependencies affecting the build of the UI (ember-cli, webpack, etc), need to be in 'dependencies', not 'devDependencies' (yarn install --production is used)"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
diff --git a/node_modules/virtual-dom/vtree/diff.js b/node_modules/virtual-dom/vtree/diff.js
|
||||
index b5bccbd..058d6b3 100644
|
||||
--- a/node_modules/virtual-dom/vtree/diff.js
|
||||
+++ b/node_modules/virtual-dom/vtree/diff.js
|
||||
@@ -311,6 +311,38 @@ function reorder(aChildren, bChildren) {
|
||||
var inserts = []
|
||||
var simulateItem
|
||||
|
||||
+ // handle prepends without reordering old elements
|
||||
+ var shift = bChildren.length - aChildren.length
|
||||
+ if (shift > 0 && simulate.length === bChildren.length) {
|
||||
+ var prepend = true
|
||||
+ for (var i = 0; prepend && i < simulate.length; i++) {
|
||||
+ prepend = simulate[i] && simulate[i].key
|
||||
+ }
|
||||
+ for (var i = 0; prepend && i < aChildren.length; i++) {
|
||||
+ prepend = aChildren[i].key === bChildren[i + shift].key
|
||||
+ }
|
||||
+
|
||||
+ if (prepend) {
|
||||
+ for (var i = 0; i < shift; i++) {
|
||||
+ removes.push({
|
||||
+ from: aChildren.length,
|
||||
+ key: bChildren[i].key
|
||||
+ })
|
||||
+ inserts.push({
|
||||
+ to: i,
|
||||
+ key: bChildren[i].key
|
||||
+ })
|
||||
+ }
|
||||
+ return {
|
||||
+ children: newChildren,
|
||||
+ moves: {
|
||||
+ removes: removes,
|
||||
+ inserts: inserts
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
for (var k = 0; k < bChildren.length;) {
|
||||
var wantedItem = bChildren[k]
|
||||
simulateItem = simulate[simulateIndex]
|
|
@ -1032,20 +1032,6 @@
|
|||
resolved "https://registry.yarnpkg.com/@discourse/itsatrap/-/itsatrap-2.0.10.tgz#c7e750eeb32b54e769e952c4ecc472213eb1385a"
|
||||
integrity sha512-Jn1gdiyHMGUsmUfLFf4Q7VnTAv0l7NePbegU6pKhKHEmbzV3FosGxq30fTOYgVyTS1bxqGjlA6LvQttJpv3ROw==
|
||||
|
||||
"@discourse/virtual-dom@^2.1.2-0":
|
||||
version "2.1.2-0"
|
||||
resolved "https://registry.yarnpkg.com/@discourse/virtual-dom/-/virtual-dom-2.1.2-0.tgz#74e44261c7b0a99b3bf6db0eac37b86e978906a6"
|
||||
integrity sha512-5sTfdNxyrFK9yb98YLBAChYiO2K6Go7ptErVUQciT7rgueoGyLyw6Sm0FeVkSK1GLfusYFKZG8ch2vGNzJ0wlQ==
|
||||
dependencies:
|
||||
browser-split "0.0.1"
|
||||
error "^4.3.0"
|
||||
ev-store "^7.0.0"
|
||||
global "^4.3.0"
|
||||
is-object "^1.0.1"
|
||||
next-tick "^0.2.2"
|
||||
x-is-array "0.1.0"
|
||||
x-is-string "0.1.0"
|
||||
|
||||
"@ember-compat/tracked-built-ins@^0.9.1":
|
||||
version "0.9.1"
|
||||
resolved "https://registry.yarnpkg.com/@ember-compat/tracked-built-ins/-/tracked-built-ins-0.9.1.tgz#4cc97c1841425fbf812ef3c63c00ab4790fc32a0"
|
||||
|
@ -2953,7 +2939,7 @@ broccoli@^3.5.1:
|
|||
browser-split@0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/browser-split/-/browser-split-0.0.1.tgz#7b097574f8e3ead606fb4664e64adfdda2981a93"
|
||||
integrity sha1-ewl1dPjj6tYG+0Zk5krf3aKYGpM=
|
||||
integrity sha512-JhvgRb2ihQhsljNda3BI8/UcRHVzrVwo3Q+P8vDtSiyobXuFpuZ9mq+MbRGMnC22CjW3RrfXdg6j6ITX8M+7Ow==
|
||||
|
||||
browserslist@^4.14.5, browserslist@^4.19.1, browserslist@^4.21.3:
|
||||
version "4.21.3"
|
||||
|
@ -3033,9 +3019,9 @@ callsites@^3.0.0, callsites@^3.1.0:
|
|||
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
|
||||
|
||||
camelize@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.0.tgz#164a5483e630fa4321e5af07020e531831b2609b"
|
||||
integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.1.tgz#89b7e16884056331a35d6b5ad064332c91daa6c3"
|
||||
integrity sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==
|
||||
|
||||
can-symlink@^1.0.0:
|
||||
version "1.0.0"
|
||||
|
@ -4487,7 +4473,7 @@ errlop@^2.0.0:
|
|||
error@^4.3.0:
|
||||
version "4.4.0"
|
||||
resolved "https://registry.yarnpkg.com/error/-/error-4.4.0.tgz#bf69ff251fb4a279c19adccdaa6b61e90d9bf12a"
|
||||
integrity sha1-v2n/JR+0onnBmtzNqmth6Q2b8So=
|
||||
integrity sha512-SNDKualLUtT4StGFP7xNfuFybL2f6iJujFtrWuvJqGbVQGaN+adE23veqzPz1hjUjTunLi2EnJ+0SJxtbJreKw==
|
||||
dependencies:
|
||||
camelize "^1.0.0"
|
||||
string-template "~0.2.0"
|
||||
|
@ -4720,7 +4706,7 @@ etag@~1.8.1:
|
|||
ev-store@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ev-store/-/ev-store-7.0.0.tgz#1ab0c7f82136505dd74b31d17701cb2be6d26558"
|
||||
integrity sha1-GrDH+CE2UF3XSzHRdwHLK+bSZVg=
|
||||
integrity sha512-otazchNRnGzp2YarBJ+GXKVGvhxVATB1zmaStxJBYet0Dyq7A9VhH8IUEB/gRcL6Ch52lfpgPTRJ2m49epyMsQ==
|
||||
dependencies:
|
||||
individual "^3.0.0"
|
||||
|
||||
|
@ -5579,11 +5565,16 @@ gopd@^1.0.1:
|
|||
dependencies:
|
||||
get-intrinsic "^1.1.3"
|
||||
|
||||
graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.9:
|
||||
graceful-fs@^4.1.11:
|
||||
version "4.2.11"
|
||||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
|
||||
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
|
||||
|
||||
graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.9:
|
||||
version "4.2.9"
|
||||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.9.tgz#041b05df45755e587a24942279b9d113146e1c96"
|
||||
integrity sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==
|
||||
|
||||
graceful-fs@~1.2.0:
|
||||
version "1.2.3"
|
||||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-1.2.3.tgz#15a4806a57547cb2d2dbf27f42e89a8c3451b364"
|
||||
|
@ -5889,7 +5880,7 @@ imurmurhash@^0.1.4:
|
|||
individual@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/individual/-/individual-3.0.0.tgz#e7ca4f85f8957b018734f285750dc22ec2f9862d"
|
||||
integrity sha1-58pPhfiVewGHNPKFdQ3CLsL5hi0=
|
||||
integrity sha512-rUY5vtT748NMRbEMrTNiFfy29BgGZwGXUi2NFUVMWQrogSLzlJvQV9eeMWi+g1aVaQ53tpyLAQtd5x/JH0Nh1g==
|
||||
|
||||
inflection@^1.12.0:
|
||||
version "1.12.0"
|
||||
|
@ -7071,7 +7062,7 @@ mimic-fn@^2.1.0:
|
|||
min-document@^2.19.0:
|
||||
version "2.19.0"
|
||||
resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685"
|
||||
integrity sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=
|
||||
integrity sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==
|
||||
dependencies:
|
||||
dom-walk "^0.1.0"
|
||||
|
||||
|
@ -7241,7 +7232,7 @@ neo-async@^2.6.0, neo-async@^2.6.2:
|
|||
next-tick@^0.2.2:
|
||||
version "0.2.2"
|
||||
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-0.2.2.tgz#75da4a927ee5887e39065880065b7336413b310d"
|
||||
integrity sha1-ddpKkn7liH45BliABltzNkE7MQ0=
|
||||
integrity sha512-f7h4svPtl+QidoBv4taKXUjJ70G2asaZ8G28nS0OkqaalX8dwwrtWtyxEDPK62AC00ur/+/E0pUwBwY5EPn15Q==
|
||||
|
||||
nice-try@^1.0.4:
|
||||
version "1.0.5"
|
||||
|
@ -7890,7 +7881,7 @@ process-relative-require@^1.0.0:
|
|||
process@^0.11.10:
|
||||
version "0.11.10"
|
||||
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
|
||||
integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI=
|
||||
integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==
|
||||
|
||||
promise-map-series@^0.2.1:
|
||||
version "0.2.3"
|
||||
|
@ -9468,6 +9459,20 @@ vary@^1, vary@~1.1.2:
|
|||
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
|
||||
integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
|
||||
|
||||
virtual-dom@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/virtual-dom/-/virtual-dom-2.1.1.tgz#80eda2d481b9ede0c049118cefcb4a05f21d1375"
|
||||
integrity sha512-wb6Qc9Lbqug0kRqo/iuApfBpJJAq14Sk1faAnSmtqXiwahg7PVTvWMs9L02Z8nNIMqbwsxzBAA90bbtRLbw0zg==
|
||||
dependencies:
|
||||
browser-split "0.0.1"
|
||||
error "^4.3.0"
|
||||
ev-store "^7.0.0"
|
||||
global "^4.3.0"
|
||||
is-object "^1.0.1"
|
||||
next-tick "^0.2.2"
|
||||
x-is-array "0.1.0"
|
||||
x-is-string "0.1.0"
|
||||
|
||||
w3c-xmlserializer@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz#aebdc84920d806222936e3cdce408e32488a3073"
|
||||
|
@ -9754,12 +9759,12 @@ ws@~8.2.3:
|
|||
x-is-array@0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/x-is-array/-/x-is-array-0.1.0.tgz#de520171d47b3f416f5587d629b89d26b12dc29d"
|
||||
integrity sha1-3lIBcdR7P0FvVYfWKbidJrEtwp0=
|
||||
integrity sha512-goHPif61oNrr0jJgsXRfc8oqtYzvfiMJpTqwE7Z4y9uH+T3UozkGqQ4d2nX9mB9khvA8U2o/UbPOFjgC7hLWIA==
|
||||
|
||||
x-is-string@0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/x-is-string/-/x-is-string-0.1.0.tgz#474b50865af3a49a9c4657f05acd145458f77d82"
|
||||
integrity sha1-R0tQhlrzpJqcRlfwWs0UVFj3fYI=
|
||||
integrity sha512-GojqklwG8gpzOVEVki5KudKNoq7MbbjYZCbyWzEz7tyPA7eleiE0+ePwOWQQRb5fm86rD3S8Tc0tSFf3AOv50w==
|
||||
|
||||
xdg-basedir@^4.0.0:
|
||||
version "4.0.0"
|
||||
|
|
Loading…
Reference in New Issue