WordPress/wp-admin/js/updates.min.js
desrosj e3353e0860 Build/Test Tools: Support NodeJS 14.x in the 4.2 branch.
This updates the 4.2 branch to support the latest LTS version of NodeJS (currently 14.x), allowing the same version to be used across all WordPress branches that receive security updates as a courtesy.

Because older branches use (really) old versions of NodeJS, the local Docker environment cannot be backported since the needed dependencies will not run on these older versions (see #48301). This also blocks the ability to move automated testing over to GitHub Actions (see #50401).

This change also introduces a `packager-lock.json` file to the branch.

In addition to backporting the package updates that happened after branching 4.2, dependencies that were removed in future releases have also been updated to their latest versions.

Props desrosj, dd32, netweb, jorbin.
Merges [32356-32357,32988,33726,34888,35335,35363,35513,35521,35538-35541,35859,36861-36865,36935,36979,37017,37019-37020,37212,37612,38111,39110,39113,39115-39119,39478,41835,42460,42461,42463,42887,43320,43323,43977,44219,44233,45321,45765,46404,46408-46409,47404,47867,47872-47873,48705,49636,49933,49937,49939,50126,50176,50185] to the 4.2 branch.
See #52341.
Built from https://develop.svn.wordpress.org/branches/4.2@50214


git-svn-id: http://core.svn.wordpress.org/branches/4.2@49883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-05 04:28:43 +00:00

1 line
8.7 KiB
JavaScript

window.wp=window.wp||{},function(d,u,n){u.updates={},u.updates.ajaxNonce=window._wpUpdatesSettings.ajax_nonce,u.updates.l10n=window._wpUpdatesSettings.l10n,u.updates.shouldRequestFilesystemCredentials=null,u.updates.filesystemCredentials={ftp:{host:null,username:null,password:null,connectionType:null},ssh:{publicKey:"",privateKey:""},fsNonce:""},u.updates.updateLock=!1,u.updates.updateDoneSuccessfully=!1,u.updates.updateQueue=[],u.updates.$elToReturnFocusToFromCredentialsModal=null,u.updates.decrementCount=function(e){var a,t=d("#wp-admin-bar-updates .ab-label"),s=d('a[href="update-core.php"] .update-plugins'),u=d("#menu-plugins"),n=t.text();(n=parseInt(n,10)-1)<0||isNaN(n)||(d("#wp-admin-bar-updates .ab-item").removeAttr("title"),t.text(n),s.each(function(e,t){t.className=t.className.replace(/count-\d+/,"count-"+n)}),s.removeAttr("title"),s.find(".update-count").text(n),"plugin"===e&&(a=u.find(".plugin-count").eq(0).text(),(a=parseInt(a,10)-1)<0||isNaN(a)||(u.find(".plugin-count").text(a),u.find(".update-plugins").each(function(e,t){t.className=t.className.replace(/count-\d+/,"count-"+a)}),0<a?d(".subsubsub .upgrade .count").text("("+a+")"):d(".subsubsub .upgrade").remove())))},u.updates.updatePlugin=function(e,t){var a,s;"plugins"===n||"plugins-network"===n?a=d('[data-slug="'+t+'"]').next().find(".update-message"):"plugin-install"===n&&(s=(a=d(".plugin-card-"+t).find(".update-now")).data("name"),a.attr("aria-label",u.updates.l10n.updatingLabel.replace("%s",s))),a.addClass("updating-message"),a.html()!==u.updates.l10n.updating&&a.data("originaltext",a.html()),a.text(u.updates.l10n.updating),u.a11y.speak(u.updates.l10n.updatingMsg),u.updates.updateLock?u.updates.updateQueue.push({type:"update-plugin",data:{plugin:e,slug:t}}):(u.updates.updateLock=!0,t={_ajax_nonce:u.updates.ajaxNonce,plugin:e,slug:t,_fs_nonce:u.updates.filesystemCredentials.fsNonce,username:u.updates.filesystemCredentials.ftp.username,password:u.updates.filesystemCredentials.ftp.password,hostname:u.updates.filesystemCredentials.ftp.hostname,connection_type:u.updates.filesystemCredentials.ftp.connectionType,public_key:u.updates.filesystemCredentials.ssh.publicKey,private_key:u.updates.filesystemCredentials.ssh.privateKey},u.ajax.post("update-plugin",t).done(u.updates.updateSuccess).fail(u.updates.updateError))},u.updates.updateSuccess=function(e){var t,a,s;"plugins"===n||"plugins-network"===n?(t=(a=d('[data-slug="'+e.slug+'"]').first()).next().find(".update-message"),a.addClass("updated").removeClass("update"),s=a.find(".plugin-version-author-uri").html().replace(e.oldVersion,e.newVersion),a.find(".plugin-version-author-uri").html(s),a.next().addClass("updated")):"plugin-install"===n&&((t=d(".plugin-card-"+e.slug).find(".update-now")).addClass("button-disabled"),a=t.data("name"),t.attr("aria-label",u.updates.l10n.updatedLabel.replace("%s",a))),t.removeClass("updating-message").addClass("updated-message"),t.text(u.updates.l10n.updated),u.a11y.speak(u.updates.l10n.updatedMsg),u.updates.decrementCount("plugin"),u.updates.updateDoneSuccessfully=!0,u.updates.updateLock=!1,d(document).trigger("wp-plugin-update-success",e),u.updates.queueChecker()},u.updates.updateError=function(e){var t,a;u.updates.updateDoneSuccessfully=!1,e.errorCode&&"unable_to_connect_to_filesystem"==e.errorCode&&u.updates.shouldRequestFilesystemCredentials?u.updates.credentialError(e,"update-plugin"):("plugins"===n||"plugins-network"===n?t=d('[data-slug="'+e.slug+'"]').next().find(".update-message"):"plugin-install"===n&&(a=(t=d(".plugin-card-"+e.slug).find(".update-now")).data("name"),t.attr("aria-label",u.updates.l10n.updateFailedLabel.replace("%s",a))),t.removeClass("updating-message"),t.html(u.updates.l10n.updateFailed+": "+e.error),u.a11y.speak(u.updates.l10n.updateFailed),u.updates.updateLock=!1,d(document).trigger("wp-plugin-update-error",e),u.updates.queueChecker())},u.updates.showErrorInCredentialsForm=function(e){var t=d(".notification-dialog");t.find(".error").remove(),t.find("h3").after('<div class="error">'+e+"</div>")},u.updates.credentialError=function(e,t){u.updates.updateQueue.push({type:t,data:{plugin:e.plugin,slug:e.slug}}),u.updates.showErrorInCredentialsForm(e.error),u.updates.requestFilesystemCredentials()},u.updates.queueChecker=function(){var e;u.updates.updateLock||u.updates.updateQueue.length<=0||(e=u.updates.updateQueue.shift(),u.updates.updatePlugin(e.data.plugin,e.data.slug))},u.updates.requestFilesystemCredentials=function(e){!1===u.updates.updateDoneSuccessfully&&("plugin-install"===n&&e&&(u.updates.$elToReturnFocusToFromCredentialsModal=d(e.target)),u.updates.updateLock=!0,u.updates.requestForCredentialsModalOpen())},u.updates.keydown=function(e){27===e.keyCode?u.updates.requestForCredentialsModalCancel():9===e.keyCode&&("upgrade"!==e.target.id||e.shiftKey?"hostname"===e.target.id&&e.shiftKey&&(d("#upgrade").focus(),e.preventDefault()):(d("#hostname").focus(),e.preventDefault()))},u.updates.requestForCredentialsModalOpen=function(){var e=d("#request-filesystem-credentials-dialog");d("body").addClass("modal-open"),e.show(),e.find("input:enabled:first").focus(),e.keydown(u.updates.keydown)},u.updates.requestForCredentialsModalClose=function(){d("#request-filesystem-credentials-dialog").hide(),d("body").removeClass("modal-open"),u.updates.$elToReturnFocusToFromCredentialsModal.focus()},u.updates.requestForCredentialsModalCancel=function(){var e,t;!1===u.updates.updateLock&&0===u.updates.updateQueue.length||(e=u.updates.updateQueue[0].data.slug,u.updates.updateLock=!1,u.updates.updateQueue=[],u.updates.requestForCredentialsModalClose(),"plugins"===n||"plugins-network"===n?t=d('[data-slug="'+e+'"]').next().find(".update-message"):"plugin-install"===n&&(t=d(".plugin-card-"+e).find(".update-now")),t.removeClass("updating-message"),t.html(t.data("originaltext")),u.a11y.speak(u.updates.l10n.updateCancel))},u.updates.beforeunload=function(){if(u.updates.updateLock)return u.updates.l10n.beforeunload},d(document).ready(function(){u.updates.shouldRequestFilesystemCredentials=!(d("#request-filesystem-credentials-dialog").length<=0),d("#request-filesystem-credentials-dialog form").on("submit",function(){return u.updates.filesystemCredentials.fsNonce=d("#_fs_nonce").val(),u.updates.filesystemCredentials.ftp.hostname=d("#hostname").val(),u.updates.filesystemCredentials.ftp.username=d("#username").val(),u.updates.filesystemCredentials.ftp.password=d("#password").val(),u.updates.filesystemCredentials.ftp.connectionType=d('input[name="connection_type"]:checked').val(),u.updates.filesystemCredentials.ssh.publicKey=d("#public_key").val(),u.updates.filesystemCredentials.ssh.privateKey=d("#private_key").val(),u.updates.requestForCredentialsModalClose(),u.updates.updateLock=!1,u.updates.queueChecker(),!1}),d('#request-filesystem-credentials-dialog [data-js-action="close"], .notification-dialog-background').on("click",function(){u.updates.requestForCredentialsModalCancel()}),d('#request-filesystem-credentials-dialog input[name="connection_type"]').on("change",function(){d(this).parents("form").find("#private_key, #public_key").parents("label").toggle("ssh"==d(this).val())}).change(),d(".plugin-update-tr").on("click",".update-link",function(e){e.preventDefault(),u.updates.shouldRequestFilesystemCredentials&&!u.updates.updateLock&&u.updates.requestFilesystemCredentials(e);e=d(e.target).parents(".plugin-update-tr");u.updates.$elToReturnFocusToFromCredentialsModal=d("#"+e.data("slug")).find(".check-column input"),u.updates.updatePlugin(e.data("plugin"),e.data("slug"))}),d(".plugin-card").on("click",".update-now",function(e){e.preventDefault();var t=d(e.target);u.updates.shouldRequestFilesystemCredentials&&!u.updates.updateLock&&u.updates.requestFilesystemCredentials(e),u.updates.updatePlugin(t.data("plugin"),t.data("slug"))}),d("#plugin_update_from_iframe").on("click",function(e){var t=window.parent==window?null:window.parent;d.support.postMessage=!!window.postMessage,!1!==d.support.postMessage&&null!==t&&-1===window.parent.location.pathname.indexOf("update-core.php")&&(e.preventDefault(),e={action:"updatePlugin",slug:d(this).data("slug")},t.postMessage(JSON.stringify(e),window.location.origin))})}),d(window).on("message",function(e){var t,a=e.originalEvent,e=document.location,e=e.protocol+"//"+e.hostname;if(a.origin===e&&void 0!==(t=d.parseJSON(a.data)).action)switch(t.action){case"decrementUpdateCount":u.updates.decrementCount(t.upgradeType);break;case"updatePlugin":tb_remove(),"plugins"===n||"plugins-network"===n?(d("#"+t.slug).find(".check-column input").focus(),d('.plugin-update-tr[data-slug="'+t.slug+'"]').find(".update-link").trigger("click")):"plugin-install"===n&&(d(".plugin-card-"+t.slug).find("h4 a").focus(),d(".plugin-card-"+t.slug).find('[data-slug="'+t.slug+'"]').trigger("click"))}}),d(window).on("beforeunload",u.updates.beforeunload)}(jQuery,window.wp,window.pagenow,window.ajaxurl);