Docs: Add file doc @output annotations.

These annotations make it clear to the reader of a JavaScript source
where the build process outputs to. These annotations can later be
integrated in a webpack configuration. This way there is one source of
truth.

The `build` folder is omitted from the paths, because a single JS file
shouldn't not be responsible of knowing where outputs in general will
end up at. A file only knows its output location relative to the
project.

Props adamsilverstein, herregroen, omarreiss, pento.
Fixes #44361.


git-svn-id: https://develop.svn.wordpress.org/trunk@43347 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Anton Timmermans 2018-06-15 10:18:44 +00:00
parent e32886cbdf
commit 78f2b0e731
90 changed files with 333 additions and 33 deletions

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/comment.js
*/
/* global postboxes, commentL10n */
/**

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/common.js
*/
/* global setUserSetting, ajaxurl, commonL10n, alert, confirm, pagenow */
var showNotice, adminMenu, columns, validateForm, screenMeta;

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/custom-background.js
*/
/* global ajaxurl */
/**

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/custom-header.js
*/
/* global isRtl */
/**

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/edit-comments.js
*/
/* global adminCommentsL10n, thousandsSeparator, list_args, QTags, ajaxurl, wpAjax */
var setCommentsList, theList, theExtraList, commentReply;

View File

@ -1,10 +1,12 @@
/* global inlineEditL10n, ajaxurl, typenow */
/**
* This file contains the functions needed for the inline editing of posts.
*
* @since 2.7.0
* @output wp-admin/js/inline-edit-post.js
*/
/* global inlineEditL10n, ajaxurl, typenow */
window.wp = window.wp || {};
/**

View File

@ -1,8 +1,11 @@
/* global inlineEditL10n, ajaxurl */
/**
* This file is used on the term overview page to power quick-editing terms.
*
* @output wp-admin/js/inline-edit-tax.js
*/
/* global inlineEditL10n, ajaxurl */
window.wp = window.wp || {};
/**

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/link.js
*/
/* global postboxes, deleteUserSetting, setUserSetting, getUserSetting */
jQuery(document).ready( function($) {

View File

@ -1,5 +1,3 @@
/* global tinymce, QTags */
/**
* Contains global functions for the media upload within the post edit screen.
*
@ -9,10 +7,13 @@
*
* @file
* @since 2.5.0
* @output wp-admin/js/media-upload.js
*
* @requires jQuery
*/
/* global tinymce, QTags */
var wpActiveEditor, send_to_editor;
/**

View File

@ -1,15 +1,17 @@
/* global ajaxurl, attachMediaBoxL10n, _wpMediaGridSettings, showNotice */
/**
* Creates a dialog containing posts that can have a particular media attached
* to it.
*
* @since 2.7.0
* @output wp-admin/js/media.js
*
* @namespace findPosts
*
* @requires jQuery
*/
/* global ajaxurl, attachMediaBoxL10n, _wpMediaGridSettings, showNotice */
var findPosts;
( function( $ ){

View File

@ -1,8 +1,10 @@
/* global plugininstallL10n, tb_click, tb_remove */
/**
* @file Functionality for the plugin install screens.
*
* @output wp-admin/js/plugin-install.js
*/
/* global plugininstallL10n, tb_click, tb_remove */
var tb_position;
jQuery( document ).ready( function( $ ) {

View File

@ -1,10 +1,12 @@
/* global postL10n, ajaxurl, wpAjax, setPostThumbnailL10n, postboxes, pagenow, tinymce, alert, deleteUserSetting */
/* global theList:true, theExtraList:true, getUserSetting, setUserSetting, commentReply */
/**
* @file Contains all dynamic functionality needed on post and term pages.
*
* @output wp-admin/js/post.js
*/
/* global postL10n, ajaxurl, wpAjax, setPostThumbnailL10n, postboxes, pagenow, tinymce, alert, deleteUserSetting */
/* global theList:true, theExtraList:true, getUserSetting, setUserSetting, commentReply */
var commentsBox, WPSetThumbnailHTML, WPSetThumbnailID, WPRemoveThumbnail, wptitlehint, makeSlugeditClickable, editPermalink;
// Backwards compatibility: prevent fatal errors.
makeSlugeditClickable = editPermalink = function(){};

View File

@ -4,6 +4,7 @@
*
* @since 2.5.0
* @requires jQuery
* @output wp-admin/js/postbox.js
*/
/* global ajaxurl, postBoxL10n */

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/set-post-thumbnail.js
*/
/* global setPostThumbnailL10n, ajaxurl, post_id, alert */
/* exported WPSetAsThumbnail */

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/tags-box.js
*/
/* jshint curly: false, eqeqeq: false */
/* global ajaxurl */

View File

@ -1,5 +1,7 @@
/**
* Default settings for jQuery UI Autocomplete for use with non-hierarchical taxonomies.
*
* @output wp-admin/js/tags-suggest.js
*/
( function( $ ) {
if ( typeof window.tagsSuggestL10n === 'undefined' || typeof window.uiAutocompleteL10n === 'undefined' ) {

View File

@ -1,11 +1,14 @@
/* global ajaxurl, wpAjax, tagsl10n, showNotice, validateForm */
/**
* Contains logic for deleting and adding tags.
*
* For deleting tags it makes a request to the server to delete the tag.
* For adding tags it makes a request to the server to add the tag.
*
* @output wp-admin/js/tags.js
*/
/* global ajaxurl, wpAjax, tagsl10n, showNotice, validateForm */
jQuery(document).ready(function($) {
/**

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/user-profile.js
*/
/* global ajaxurl, pwsL10n, userProfileL10n */
(function($) {
var updateLock = false,

View File

@ -1,4 +1,8 @@
/*global ajaxurl, isRtl */
/**
* @output wp-admin/js/widgets.js
*/
/* global ajaxurl, isRtl */
var wpWidgets;
(function($) {
var $document = $( document );

View File

@ -2,6 +2,7 @@
* Generates the XHTML Friends Network 'rel' string from the inputs.
*
* @deprecated 3.5.0
* @output wp-admin/js/xfn.js
*/
jQuery( document ).ready(function( $ ) {
$( '#link_rel' ).prop( 'readonly', true );

View File

@ -1,8 +1,9 @@
/**
* Distraction-Free Writing (wp-fullscreen) backward compatibility stub.
* Todo: remove at the end of 2016.
*
* Original was deprecated in 4.1, removed in 4.3.
* @deprecated 4.1
* @removed 4.3.
* @output wp-admin/js/wp-fullscreen-stub.js
*/
( function() {
var noop = function(){};

View File

@ -1,9 +1,11 @@
/* global ajaxurl */
/**
* This file is used on media-upload.php which has been replaced by media-new.php and upload.php
* Deprecated since 3.5.0
*
* @deprecated 3.5.0
* @output wp-admin/js/media-gallery.js
*/
/* global ajaxurl */
jQuery(function($) {
/**
* Adds a click event handler to the element with a 'wp-gallery' class.

View File

@ -26,6 +26,7 @@
* Note that any appropriate tags may be used, as long as the above classes are present.
*
* @since 3.6.0
* @output wp-admin/js/accordion.js
*/
( function( $ ){

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/admin-bar.js
*/
/* jshint loopfunc: true */
// use jQuery and hoverIntent if loaded
if ( typeof(jQuery) != 'undefined' ) {

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/wp-ajax-response.js
*/
var wpAjax = jQuery.extend( {
unserialize: function( s ) {
var r = {}, q, pp, i, p;

View File

@ -1,5 +1,10 @@
/**
* Interim login dialog.
*
* @output wp-includes/js/wp-auth-check.js
*/
/* global adminpage */
// Interim login dialog
(function($){
var wrap, next;

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/color-picker.js
*/
/* global wpColorPickerL10n */
( function( $, undef ) {

View File

@ -2,6 +2,7 @@
* Handles the addition of the comment form.
*
* @since 2.7.0
* @output wp-includes/js/comment-reply.js
*
* @namespace addComment
*

View File

@ -1,6 +1,11 @@
/**
* Cookie functions.
*
* @output wp-includes/js/utils.js
*/
/* global userSettings */
/* exported getUserSetting, setUserSetting, deleteUserSetting */
// utility functions
var wpCookies = {
// The following functions are from Cookie.js class in TinyMCE 3, Moxiecode, used under LGPL.
@ -195,4 +200,3 @@ function getAllUserSettings() {
return wpCookies.getHash( 'wp-settings-' + userSettings.uid ) || {};
}

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/wpdialog.js
*/
/*
* Wrap the jQuery UI Dialog open function remove focus from tinyMCE.
*/

View File

@ -1,3 +1,6 @@
/**
* @output wp-includes/js/wp-embed-template.js
*/
(function ( window, document ) {
'use strict';

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/wp-emoji-loader.js
*/
( function( window, document, settings ) {
var src, ready, ii, tests;

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/gallery.js
*/
/* global unescape, getUserSetting, setUserSetting */
jQuery(document).ready(function($) {

View File

@ -1,10 +1,12 @@
/* global imageEditL10n, ajaxurl, confirm */
/**
* The functions necessary for editing images.
*
* @since 2.9.0
* @output wp-admin/js/image-edit.js
*/
/* global imageEditL10n, ajaxurl, confirm */
(function($) {
/**

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/language-chooser.js
*/
jQuery( function($) {
/*
* Set the correct translation to the continue button and show a spinner

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/wplink.js
*/
var wpLink;
( function( $, wpLinkL10n, wp ) {

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/wp-list-revisions.js
*/
(function(w) {
var init = function() {
var pr = document.getElementById('post-revisions'),

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/wp-lists.js
*/
/* global ajaxurl, wpAjax */
/**

View File

@ -6,6 +6,7 @@
*
* @package WordPress
* @subpackage Administration
* @output wp-admin/js/nav-menu.js
*/
/* global menus, postboxes, columns, isRtl, navMenuL10n, ajaxurl */

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/wp-pointer.js
*/
/* global wpPointerL10n */
/**

View File

@ -1,4 +1,4 @@
/* global adminpage, wpActiveEditor, quicktagsL10n, wpLink, prompt */
/*
* Quicktags
*
@ -16,12 +16,16 @@
*
* quicktags_id string The ID of the textarea that will be the editor canvas
* buttons string Comma separated list of the default buttons names that will be shown in that instance.
*
* @output wp-includes/js/quicktags.js
*/
// new edit toolbar used with permission
// by Alex King
// http://www.alexking.org/
/* global adminpage, wpActiveEditor, quicktagsL10n, wpLink, prompt */
var QTags, edCanvas,
edButtons = [];

View File

@ -1,4 +1,3 @@
/* global ajaxurl, current_site_id, isRtl */
/**
* Suggests users in a multisite environment.
*
@ -8,8 +7,11 @@
* site are shown.
*
* @since 3.4.0
* @output wp-admin/js/user-suggest.js
*/
/* global ajaxurl, current_site_id, isRtl */
(function( $ ) {
var id = ( typeof current_site_id !== 'undefined' ) ? '&site_id=' + current_site_id : '';
$(document).ready( function() {

View File

@ -1,4 +1,9 @@
/**
* @output wp-includes/js/zxcvbn-async.js
*/
/* global _zxcvbnSettings */
/**
* Loads zxcvbn asynchronously by inserting an async script tag before the first
* script tag on the page.

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/wp-a11y.js
*/
/** @namespace wp */
window.wp = window.wp || {};

View File

@ -9,6 +9,7 @@
* - Allows specifying only an endpoint namespace/path instead of a full URL.
*
* @since 4.9.0
* @output wp-includes/js/api-request.js
*/
( function( $ ) {

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/wp-api.js
*/
(function( window, undefined ) {
'use strict';

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/autosave.js
*/
/* global tinymce, wpCookies, autosaveL10n, switchEditors */
// Back-compat
window.autosave = function() {

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/wp-backbone.js
*/
/** @namespace wp */
window.wp = window.wp || {};

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/code-editor.js
*/
if ( 'undefined' === typeof window.wp ) {
/**
* @namespace wp

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/wp-custom-header.js
*/
/* global YT */
(function( window, settings ) {

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/customize-base.js
*/
/** @namespace wp */
window.wp = window.wp || {};

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/customize-controls.js
*/
/* global _wpCustomizeHeader, _wpCustomizeBackground, _wpMediaViewsL10n, MediaElementPlayer, console, confirm */
(function( exports, $ ){
var Container, focus, normalizedTransitionendEventName, api = wp.customize;

View File

@ -1,4 +1,9 @@
/**
* @output wp-includes/js/customize-loader.js
*/
/* global _wpCustomizeLoaderSettings */
/**
* Expose a public API that allows the customizer to be
* loaded on any page.

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/customize-models.js
*/
/* global _wpCustomizeHeader */
(function( $, wp ) {
var api = wp.customize;

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/customize-nav-menus.js
*/
/* global _wpCustomizeNavMenusSettings, wpNavMenu, console */
( function( api, wp, $ ) {
'use strict';

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/customize-preview-nav-menus.js
*/
/* global _wpCustomizePreviewNavMenusExports */
/** @namespace wp.customize.navMenusPreview */

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/customize-preview-widgets.js
*/
/* global _wpWidgetCustomizerPreviewSettings */
/**

View File

@ -1,5 +1,7 @@
/*
* Script run inside a Customizer preview frame.
*
* @output wp-includes/js/customize-preview.js
*/
(function( exports, $ ){
var api = wp.customize,

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/customize-selective-refresh.js
*/
/* global jQuery, JSON, _customizePartialRefreshExports, console */
/** @namespace wp.customize.selectiveRefresh */

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/customize-views.js
*/
(function( $, wp, _ ) {
if ( ! wp || ! wp.customize ) { return; }

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/customize-widgets.js
*/
/* global _wpCustomizeWidgetsSettings */
(function( wp, $ ){

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/dashboard.js
*/
/* global pagenow, ajaxurl, postboxes, wpActiveEditor:true */
var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad;
window.wp = window.wp || {};

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/editor.js
*/
window.wp = window.wp || {};
( function( $, wp ) {

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/editor-expand.js
*/
( function( window, $, undefined ) {
'use strict';

View File

@ -2,6 +2,7 @@
* WordPress inline HTML embed
*
* @since 4.4.0
* @output wp-includes/js/wp-embed.js
*
* This file cannot have ampersands in it. This is to ensure
* it can be embedded in older versions of WordPress.

View File

@ -1,3 +1,6 @@
/**
* @output wp-includes/js/wp-emoji.js
*/
( function( window, settings ) {
function wpEmoji() {

View File

@ -24,6 +24,7 @@
* - heartbeat-nonces-expired
*
* @since 3.6.0
* @output wp-includes/js/heartbeat.js
*/
( function( $, window, undefined ) {

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/mce-view.js
*/
/* global tinymce */
/*

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/media-audiovideo.js
*/
var media = wp.media,
baseSettings = window._wpmejsSettings || {},
l10n = window._wpMediaViewsL10n || {};

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/media-editor.js
*/
/* global getUserSetting, tinymce, QTags */
// WordPress, TinyMCE, and Media

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/media-grid.js
*/
var media = wp.media;
media.controller.EditAttachmentMetadata = require( '../../../media/controllers/edit-attachment-metadata.js' );

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/media-models.js
*/
var $ = jQuery,
Attachment, Attachments, l10n, media;

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/media-views.js
*/
var media = wp.media,
$ = jQuery,
l10n;

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/password-strength-meter.js
*/
/* global zxcvbn */
window.wp = window.wp || {};

View File

@ -1,10 +1,12 @@
/* global isRtl */
/**
* @file Revisions interface functions, Backbone classes and
* the revisions.php document.ready bootstrap.
*
* @output wp-admin/js/revisions.js
*/
/* global isRtl */
window.wp = window.wp || {};
(function($) {

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/wp-sanitize.js
*/
( function () {
window.wp = window.wp || {};

View File

@ -1,4 +1,8 @@
// Utility functions for parsing and handling shortcodes in JavaScript.
/**
* Utility functions for parsing and handling shortcodes in JavaScript.
*
* @output wp-includes/js/shortcode.js
*/
/**
* Ensure the global `wp` object exists.

View File

@ -1,6 +1,7 @@
/**
* Attempt to re-color SVG icons used in the admin menu or the toolbar
*
* @output wp-admin/js/svg-painter.js
*/
window.wp = window.wp || {};

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/theme-plugin-editor.js
*/
/* eslint no-magic-numbers: ["error", { "ignore": [-1, 0, 1] }] */
if ( ! window.wp ) {

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/theme.js
*/
/* global _wpThemeSettings, confirm */
window.wp = window.wp || {};

View File

@ -2,6 +2,7 @@
* Functions for ajaxified updates, deletions and installs inside the WordPress admin.
*
* @version 4.2.0
* @output wp-admin/js/updates.js
*/
/* global pagenow */
@ -2322,14 +2323,14 @@
$( 'input.wp-filter-search' ).trigger( 'input' );
} );
/**
* Trigger a search event when the "Try Again" button is clicked.
*
/**
* Trigger a search event when the "Try Again" button is clicked.
*
* @since 4.9.0
*/
$document.on( 'click', '.try-again', function( event ) {
event.preventDefault();
$pluginInstallSearch.trigger( 'input' );
*/
$document.on( 'click', '.try-again', function( event ) {
event.preventDefault();
$pluginInstallSearch.trigger( 'input' );
} );
/**

View File

@ -1,3 +1,7 @@
/**
* @output wp-includes/js/wp-util.js
*/
/* global _wpUtilSettings */
/** @namespace wp */

View File

@ -4,6 +4,7 @@
*
* @namespace wp.utils
* @since 2.6.0
* @output wp-admin/js/word-count.js
*/
( function() {

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/widgets/custom-html-widgets.js
*/
/* global wp */
/* eslint consistent-this: [ "error", "control" ] */
/* eslint no-magic-numbers: ["error", { "ignore": [0,1,-1] }] */

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/widgets/media-audio-widget.js
*/
/* eslint consistent-this: [ "error", "control" ] */
(function( component ) {
'use strict';

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/widgets/media-gallery-widget.js
*/
/* eslint consistent-this: [ "error", "control" ] */
(function( component ) {
'use strict';

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/widgets/media-image-widget.js
*/
/* eslint consistent-this: [ "error", "control" ] */
(function( component, $ ) {
'use strict';

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/widgets/media-video-widget.js
*/
/* eslint consistent-this: [ "error", "control" ] */
(function( component ) {
'use strict';

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/widgets/media-widgets.js
*/
/* eslint consistent-this: [ "error", "control" ] */
/**

View File

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/widgets/text-widgets.js
*/
/* global tinymce, switchEditors */
/* eslint consistent-this: [ "error", "control" ] */