Once upon a midnight dreary, while I coded, weak and weary,

In many a strange and curious file of forgotten lore—
While I pondered, blaming Nacin, my notifications suddenly awakened,
As of someone quietly DMing;—DMing me, I can’t ignore.
“’Tis some contributor,” I muttered, “DMing me an idea or four—
            Only this and nothing more.”

Ah, distinctly I remember, at WordCamp US, last December;
A mad proposal nearly laid me—down out cold—upon the floor.
Curious, I listened closely;—to a plan I agreed with, mostly—
A way to make our JavaScript—JavaScript which was a chore—
Maintainable, extendable, for the future, is what I saw.
            Guten-ready for evermore.

Open here I switch to Slack, when, with many a patch and hack,
In there stepped Omar, a JavaScript developer hardcore;
Pronouncing all the changes fit; ready now to be commit;
“There’s nothing else for us to do,” DMing me, “It’s done!” he swore—
“No longer random guessing at which file need next be explored—
            Let’s move on, we’re all aboard.”

Moved all together, grouped and managed, in folders all is packaged,
The code had all been cleaned and tidied, important parts moved to the fore,
“Though this change be useful here,” I said, “it is too large, I fear,
We couldn’t manage such a patch, we’ve done nothing like this before—
Tell me where doth go this change, change to make our codebase soar!”
            Quoth Omar, “In WordPress Core.”

Props omarreis for shepherding this significant change.
Props adamsilverstein, aduth, atimmer, dingo_bastard, frank-klein, gziolo, herregroen, jaswrks, jeremyfelt, jipmoors, jorbin, netweb, ocean90, pento, tjnowell, and youknowriad for testing, feedback, discussion, encouragement, commiserations, etc.
I make no apologies for this commit message.
Fixes #43055.



git-svn-id: https://develop.svn.wordpress.org/trunk@43309 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2018-05-23 10:04:22 +00:00
parent acebda9aa5
commit ef37f002ee
426 changed files with 12835 additions and 37575 deletions

4
.gitignore vendored
View File

@ -17,7 +17,6 @@ wp-tests-config.php
/tests/phpunit/build /tests/phpunit/build
/wp-cli.local.yml /wp-cli.local.yml
/jsdoc /jsdoc
/vendor
# Files and folders that get created in wp-content # Files and folders that get created in wp-content
/src/wp-content/blogs.dir /src/wp-content/blogs.dir
@ -58,3 +57,6 @@ wp-tests-config.php
*.patch *.patch
*.diff *.diff
.svn .svn
vendor
!/src/js/_enqueues/vendor

1
.npmrc Normal file
View File

@ -0,0 +1 @@
save-exact = true

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
lts/*

View File

@ -83,6 +83,7 @@ module.exports = function(grunt) {
}, },
clean: { clean: {
all: [BUILD_DIR], all: [BUILD_DIR],
js: [BUILD_DIR + 'wp-admin/js/', BUILD_DIR + 'wp-includes/js/'],
dynamic: { dynamic: {
dot: true, dot: true,
expand: true, expand: true,
@ -92,6 +93,17 @@ module.exports = function(grunt) {
tinymce: ['<%= concat.tinymce.dest %>'], tinymce: ['<%= concat.tinymce.dest %>'],
qunit: ['tests/qunit/compiled.html'] qunit: ['tests/qunit/compiled.html']
}, },
file_append: {
default_options: {
files: [
{
append: 'jQuery.noConflict();',
input: './build/wp-includes/js/jquery/jquery.js',
output: './build/wp-includes/js/jquery/jquery.js'
}
]
}
},
copy: { copy: {
files: { files: {
files: [ files: [
@ -101,24 +113,169 @@ module.exports = function(grunt) {
cwd: SOURCE_DIR, cwd: SOURCE_DIR,
src: [ src: [
'**', '**',
'!wp-includes/js/media/**', '!js/**', // JavaScript is extracted into separate copy tasks.
'!**/.{svn,git}/**', // Ignore version control directories. '!**/.{svn,git}/**', // Ignore version control directories.
// Ignore unminified versions of external libs we don't ship: '!wp-includes/version.php', // Exclude version.php
'!wp-includes/js/backbone.js', '!index.php', '!wp-admin/index.php',
'!wp-includes/js/underscore.js', '!_index.php', '!wp-admin/_index.php'
'!wp-includes/js/jquery/jquery.masonry.js',
'!wp-includes/js/jquery/ui/*.js',
'!wp-includes/js/tinymce/tinymce.js',
'!wp-includes/version.php' // Exclude version.php
], ],
dest: BUILD_DIR dest: BUILD_DIR
}, },
{ {
src: 'wp-config-sample.php', src: 'wp-config-sample.php',
dest: BUILD_DIR dest: BUILD_DIR
},
{
'build/index.php': ['src/_index.php'],
'build/wp-admin/index.php': ['src/wp-admin/_index.php']
} }
] ]
}, },
'npm-packages': {
files: {
'build/wp-includes/js/backbone.js': ['./node_modules/backbone/backbone.js'],
'build/wp-includes/js/hoverIntent.js': ['./node_modules/jquery-hoverintent/jquery.hoverIntent.js'],
'build/wp-includes/js/imagesloaded.min.js': ['./node_modules/imagesloaded/imagesloaded.pkgd.min.js'],
'build/wp-includes/js/jquery/jquery-migrate.js': ['./node_modules/jquery-migrate/dist/jquery-migrate.js'],
'build/wp-includes/js/jquery/jquery-migrate.min.js': ['./node_modules/jquery-migrate/dist/jquery-migrate.min.js'],
'build/wp-includes/js/jquery/jquery.form.js': ['./node_modules/jquery-form/src/jquery.form.js'],
'build/wp-includes/js/jquery/jquery.form.min.js': ['./node_modules/jquery-form/dist/jquery.form.min.js'],
'build/wp-includes/js/jquery/jquery.js': ['./node_modules/jquery/dist/jquery.min.js'],
'build/wp-includes/js/masonry.min.js': ['./node_modules/masonry-layout/dist/masonry.pkgd.min.js'],
'build/wp-includes/js/twemoji.js': ['./node_modules/twemoji/2/twemoji.js'],
'build/wp-includes/js/underscore.min.js': ['./node_modules/underscore/underscore-min.js']
}
},
'vendor-js': {
files: [
{
expand: true,
cwd: SOURCE_DIR + 'js/_enqueues/vendor/',
src: [
'**/*',
'!farbtastic.js',
'!iris.min.js',
'!deprecated/**',
'!README.md',
// Ignore unminified version of vendor lib we don't ship.
'!jquery/jquery.masonry.js',
'!tinymce/tinymce.js'
],
dest: 'build/wp-includes/js/'
},
{
expand: true,
cwd: SOURCE_DIR + 'js/_enqueues/vendor/',
src: [
'farbtastic.js',
'iris.min.js'
],
dest: 'build/wp-admin/js/'
},
{
expand: true,
cwd: SOURCE_DIR + 'js/_enqueues/vendor/deprecated',
src: [
'suggest*'
],
dest: 'build/wp-includes/js/jquery/'
}
]
},
'admin-js': {
files: {
'build/wp-admin/js/accordion.js': ['./src/js/_enqueues/lib/accordion.js'],
'build/wp-admin/js/code-editor.js': ['./src/js/_enqueues/wp/code-editor.js'],
'build/wp-admin/js/color-picker.js': ['./src/js/_enqueues/lib/color-picker.js'],
'build/wp-admin/js/comment.js': ['./src/js/_enqueues/admin/comment.js'],
'build/wp-admin/js/common.js': ['./src/js/_enqueues/admin/common.js'],
'build/wp-admin/js/custom-background.js': ['./src/js/_enqueues/admin/custom-background.js'],
'build/wp-admin/js/custom-header.js': ['./src/js/_enqueues/admin/custom-header.js'],
'build/wp-admin/js/customize-controls.js': ['./src/js/_enqueues/wp/customize/controls.js'],
'build/wp-admin/js/customize-nav-menus.js': ['./src/js/_enqueues/wp/customize/nav-menus.js'],
'build/wp-admin/js/customize-widgets.js': ['./src/js/_enqueues/wp/customize/widgets.js'],
'build/wp-admin/js/dashboard.js': ['./src/js/_enqueues/wp/dashboard.js'],
'build/wp-admin/js/edit-comments.js': ['./src/js/_enqueues/admin/edit-comments.js'],
'build/wp-admin/js/editor-expand.js': ['./src/js/_enqueues/wp/editor/dfw.js'],
'build/wp-admin/js/editor.js': ['./src/js/_enqueues/wp/editor/base.js'],
'build/wp-admin/js/gallery.js': ['./src/js/_enqueues/lib/gallery.js'],
'build/wp-admin/js/image-edit.js': ['./src/js/_enqueues/lib/image-edit.js'],
'build/wp-admin/js/inline-edit-post.js': ['./src/js/_enqueues/admin/inline-edit-post.js'],
'build/wp-admin/js/inline-edit-tax.js': ['./src/js/_enqueues/admin/inline-edit-tax.js'],
'build/wp-admin/js/language-chooser.js': ['./src/js/_enqueues/lib/language-chooser.js'],
'build/wp-admin/js/link.js': ['./src/js/_enqueues/admin/link.js'],
'build/wp-admin/js/media-gallery.js': ['./src/js/_enqueues/deprecated/media-gallery.js'],
'build/wp-admin/js/media-upload.js': ['./src/js/_enqueues/admin/media-upload.js'],
'build/wp-admin/js/media.js': ['./src/js/_enqueues/admin/media.js'],
'build/wp-admin/js/nav-menu.js': ['./src/js/_enqueues/lib/nav-menu.js'],
'build/wp-admin/js/password-strength-meter.js': ['./src/js/_enqueues/wp/password-strength-meter.js'],
'build/wp-admin/js/plugin-install.js': ['./src/js/_enqueues/admin/plugin-install.js'],
'build/wp-admin/js/post.js': ['./src/js/_enqueues/admin/post.js'],
'build/wp-admin/js/postbox.js': ['./src/js/_enqueues/admin/postbox.js'],
'build/wp-admin/js/revisions.js': ['./src/js/_enqueues/wp/revisions.js'],
'build/wp-admin/js/set-post-thumbnail.js': ['./src/js/_enqueues/admin/set-post-thumbnail.js'],
'build/wp-admin/js/svg-painter.js': ['./src/js/_enqueues/wp/svg-painter.js'],
'build/wp-admin/js/tags-box.js': ['./src/js/_enqueues/admin/tags-box.js'],
'build/wp-admin/js/tags-suggest.js': ['./src/js/_enqueues/admin/tags-suggest.js'],
'build/wp-admin/js/tags.js': ['./src/js/_enqueues/admin/tags.js'],
'build/wp-admin/js/theme-plugin-editor.js': ['./src/js/_enqueues/wp/theme-plugin-editor.js'],
'build/wp-admin/js/theme.js': ['./src/js/_enqueues/wp/theme.js'],
'build/wp-admin/js/updates.js': ['./src/js/_enqueues/wp/updates.js'],
'build/wp-admin/js/user-profile.js': ['./src/js/_enqueues/admin/user-profile.js'],
'build/wp-admin/js/user-suggest.js': ['./src/js/_enqueues/lib/user-suggest.js'],
'build/wp-admin/js/widgets/custom-html-widgets.js': ['./src/js/_enqueues/wp/widgets/custom-html.js'],
'build/wp-admin/js/widgets/media-audio-widget.js': ['./src/js/_enqueues/wp/widgets/media-audio.js'],
'build/wp-admin/js/widgets/media-gallery-widget.js': ['./src/js/_enqueues/wp/widgets/media-gallery.js'],
'build/wp-admin/js/widgets/media-image-widget.js': ['./src/js/_enqueues/wp/widgets/media-image.js'],
'build/wp-admin/js/widgets/media-video-widget.js': ['./src/js/_enqueues/wp/widgets/media-video.js'],
'build/wp-admin/js/widgets/media-widgets.js': ['./src/js/_enqueues/wp/widgets/media.js'],
'build/wp-admin/js/widgets/text-widgets.js': ['./src/js/_enqueues/wp/widgets/text.js'],
'build/wp-admin/js/widgets.js': ['./src/js/_enqueues/admin/widgets.js'],
'build/wp-admin/js/word-count.js': ['./src/js/_enqueues/wp/utils/word-count.js'],
'build/wp-admin/js/wp-fullscreen-stub.js': ['./src/js/_enqueues/deprecated/fullscreen-stub.js'],
'build/wp-admin/js/xfn.js': ['./src/js/_enqueues/admin/xfn.js']
}
},
'includes-js': {
files: {
'build/wp-includes/js/admin-bar.js': ['./src/js/_enqueues/lib/admin-bar.js'],
'build/wp-includes/js/api-request.js': ['./src/js/_enqueues/wp/api-request.js'],
'build/wp-includes/js/autosave.js': ['./src/js/_enqueues/wp/autosave.js'],
'build/wp-includes/js/comment-reply.js': ['./src/js/_enqueues/lib/comment-reply.js'],
'build/wp-includes/js/customize-base.js': ['./src/js/_enqueues/wp/customize/base.js'],
'build/wp-includes/js/customize-loader.js': ['./src/js/_enqueues/wp/customize/loader.js'],
'build/wp-includes/js/customize-models.js': ['./src/js/_enqueues/wp/customize/models.js'],
'build/wp-includes/js/customize-preview-nav-menus.js': ['./src/js/_enqueues/wp/customize/preview-nav-menus.js'],
'build/wp-includes/js/customize-preview-widgets.js': ['./src/js/_enqueues/wp/customize/preview-widgets.js'],
'build/wp-includes/js/customize-preview.js': ['./src/js/_enqueues/wp/customize/preview.js'],
'build/wp-includes/js/customize-selective-refresh.js': ['./src/js/_enqueues/wp/customize/selective-refresh.js'],
'build/wp-includes/js/customize-views.js': ['./src/js/_enqueues/wp/customize/views.js'],
'build/wp-includes/js/heartbeat.js': ['./src/js/_enqueues/wp/heartbeat.js'],
'build/wp-includes/js/mce-view.js': ['./src/js/_enqueues/wp/mce-view.js'],
'build/wp-includes/js/media-editor.js': ['./src/js/_enqueues/wp/media/editor.js'],
'build/wp-includes/js/quicktags.js': ['./src/js/_enqueues/lib/quicktags.js'],
'build/wp-includes/js/shortcode.js': ['./src/js/_enqueues/wp/shortcode.js'],
'build/wp-includes/js/utils.js': ['./src/js/_enqueues/lib/cookies.js'],
'build/wp-includes/js/wp-a11y.js': ['./src/js/_enqueues/wp/a11y.js'],
'build/wp-includes/js/wp-ajax-response.js': ['./src/js/_enqueues/lib/ajax-response.js'],
'build/wp-includes/js/wp-api.js': ['./src/js/_enqueues/wp/api.js'],
'build/wp-includes/js/wp-auth-check.js': ['./src/js/_enqueues/lib/auth-check.js'],
'build/wp-includes/js/wp-backbone.js': ['./src/js/_enqueues/wp/backbone.js'],
'build/wp-includes/js/wp-custom-header.js': ['./src/js/_enqueues/wp/custom-header.js'],
'build/wp-includes/js/wp-embed-template.js': ['./src/js/_enqueues/lib/embed-template.js'],
'build/wp-includes/js/wp-embed.js': ['./src/js/_enqueues/wp/embed.js'],
'build/wp-includes/js/wp-emoji-loader.js': ['./src/js/_enqueues/lib/emoji-loader.js'],
'build/wp-includes/js/wp-emoji.js': ['./src/js/_enqueues/wp/emoji.js'],
'build/wp-includes/js/wp-list-revisions.js': ['./src/js/_enqueues/lib/list-revisions.js'],
'build/wp-includes/js/wp-lists.js': ['./src/js/_enqueues/lib/lists.js'],
'build/wp-includes/js/wp-pointer.js': ['./src/js/_enqueues/lib/pointer.js'],
'build/wp-includes/js/wp-sanitize.js': ['./src/js/_enqueues/wp/sanitize.js'],
'build/wp-includes/js/wp-util.js': ['./src/js/_enqueues/wp/util.js'],
'build/wp-includes/js/wpdialog.js': ['./src/js/_enqueues/lib/dialog.js'],
'build/wp-includes/js/wplink.js': ['./src/js/_enqueues/lib/link.js'],
'build/wp-includes/js/zxcvbn-async.js': ['./src/js/_enqueues/lib/zxcvbn-async.js']
}
},
'wp-admin-css-compat-rtl': { 'wp-admin-css-compat-rtl': {
options: { options: {
processContent: function( src ) { processContent: function( src ) {
@ -169,12 +326,15 @@ module.exports = function(grunt) {
dest: BUILD_DIR, dest: BUILD_DIR,
src: [] src: []
}, },
'dynamic-js': {
files: {}
},
qunit: { qunit: {
src: 'tests/qunit/index.html', src: 'tests/qunit/index.html',
dest: 'tests/qunit/compiled.html', dest: 'tests/qunit/compiled.html',
options: { options: {
processContent: function( src ) { processContent: function( src ) {
return src.replace( /(\".+?\/)src(\/.+?)(?:.min)?(.js\")/g , function( match, $1, $2, $3 ) { return src.replace( /(\".+?\/)build(\/.+?)(?:.min)?(.js\")/g , function( match, $1, $2, $3 ) {
// Don't add `.min` to files that don't have it. // Don't add `.min` to files that don't have it.
return $1 + 'build' + $2 + ( /jquery$/.test( $2 ) ? '' : '.min' ) + $3; return $1 + 'build' + $2 + ( /jquery$/.test( $2 ) ? '' : '.min' ) + $3;
} ); } );
@ -200,7 +360,7 @@ module.exports = function(grunt) {
}, },
core: { core: {
expand: true, expand: true,
cwd: SOURCE_DIR, cwd: BUILD_DIR,
dest: BUILD_DIR, dest: BUILD_DIR,
ext: '.min.css', ext: '.min.css',
src: [ src: [
@ -343,38 +503,16 @@ module.exports = function(grunt) {
}, },
media: { media: {
src: [ src: [
SOURCE_DIR + 'wp-includes/js/media/**/*.js' SOURCE_DIR + 'js/media/**/*.js'
] ]
}, },
core: { core: {
expand: true, expand: true,
cwd: SOURCE_DIR, cwd: SOURCE_DIR,
src: [ src: [
'wp-admin/js/**/*.js', 'js/_enqueues/**/*.js',
'wp-includes/js/*.js',
// Built scripts.
'!wp-includes/js/media-*',
// WordPress scripts inside directories
'wp-includes/js/jquery/jquery.table-hotkeys.js',
'wp-includes/js/mediaelement/mediaelement-migrate.js',
'wp-includes/js/mediaelement/wp-mediaelement.js',
'wp-includes/js/mediaelement/wp-playlist.js',
'wp-includes/js/plupload/handlers.js',
'wp-includes/js/plupload/wp-plupload.js',
'wp-includes/js/tinymce/plugins/wordpress/plugin.js',
'wp-includes/js/tinymce/plugins/wp*/plugin.js',
// Third party scripts // Third party scripts
'!wp-includes/js/codemirror/*.js', '!js/_enqueues/vendor/**/*.js'
'!wp-admin/js/farbtastic.js',
'!wp-includes/js/backbone*.js',
'!wp-includes/js/swfobject.js',
'!wp-includes/js/underscore*.js',
'!wp-includes/js/colorpicker.js',
'!wp-includes/js/hoverIntent.js',
'!wp-includes/js/json2.js',
'!wp-includes/js/tw-sack.js',
'!wp-includes/js/twemoji.js',
'!**/*.min.js'
], ],
// Remove once other JSHint errors are resolved // Remove once other JSHint errors are resolved
options: { options: {
@ -487,7 +625,7 @@ module.exports = function(grunt) {
}, },
core: { core: {
expand: true, expand: true,
cwd: SOURCE_DIR, cwd: BUILD_DIR,
dest: BUILD_DIR, dest: BUILD_DIR,
ext: '.min.js', ext: '.min.js',
src: [ src: [
@ -501,14 +639,10 @@ module.exports = function(grunt) {
'wp-includes/js/tinymce/plugins/wp*/plugin.js', 'wp-includes/js/tinymce/plugins/wp*/plugin.js',
// Exceptions // Exceptions
'!**/*.min.js',
'!wp-admin/js/custom-header.js', // Why? We should minify this. '!wp-admin/js/custom-header.js', // Why? We should minify this.
'!wp-admin/js/farbtastic.js', '!wp-admin/js/farbtastic.js',
'!wp-admin/js/iris.min.js',
'!wp-includes/js/backbone.*',
'!wp-includes/js/masonry.min.js',
'!wp-includes/js/swfobject.js', '!wp-includes/js/swfobject.js',
'!wp-includes/js/underscore.*',
'!wp-includes/js/zxcvbn.min.js',
'!wp-includes/js/wp-embed.js' // We have extra options for this, see uglify:embed '!wp-includes/js/wp-embed.js' // We have extra options for this, see uglify:embed
] ]
}, },
@ -519,45 +653,32 @@ module.exports = function(grunt) {
} }
}, },
expand: true, expand: true,
cwd: SOURCE_DIR, cwd: BUILD_DIR,
dest: BUILD_DIR, dest: BUILD_DIR,
ext: '.min.js', ext: '.min.js',
src: ['wp-includes/js/wp-embed.js'] src: ['wp-includes/js/wp-embed.js']
}, },
media: {
expand: true,
cwd: SOURCE_DIR,
dest: BUILD_DIR,
ext: '.min.js',
src: [
'wp-includes/js/media-audiovideo.js',
'wp-includes/js/media-grid.js',
'wp-includes/js/media-models.js',
'wp-includes/js/media-views.js'
]
},
jqueryui: { jqueryui: {
options: { options: {
// Preserve comments that start with a bang. // Preserve comments that start with a bang.
preserveComments: /^!/ preserveComments: /^!/
}, },
expand: true, expand: true,
cwd: SOURCE_DIR, cwd: 'node_modules/jquery-ui/ui/',
dest: BUILD_DIR, dest: BUILD_DIR + 'wp-includes/js/jquery/ui/',
ext: '.min.js', ext: '.min.js',
src: ['wp-includes/js/jquery/ui/*.js'] src: ['*.js']
},
masonry: {
options: {
// Preserve comments that start with a bang.
preserveComments: /^!/
},
src: SOURCE_DIR + 'wp-includes/js/jquery/jquery.masonry.js',
dest: SOURCE_DIR + 'wp-includes/js/jquery/jquery.masonry.min.js'
}, },
imgareaselect: { imgareaselect: {
src: SOURCE_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.js', src: BUILD_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.js',
dest: SOURCE_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.min.js' dest: BUILD_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.min.js'
},
dynamic: {
expand: true,
cwd: BUILD_DIR,
dest: BUILD_DIR,
ext: '.min.js',
src: []
} }
}, },
webpack: { webpack: {
@ -603,6 +724,195 @@ module.exports = function(grunt) {
dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js.gz' dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js.gz'
} }
}, },
patch:{
options: {
file_mappings: {
'src/wp-admin/js/accordion.js': 'src/js/_enqueues/lib/accordion.js',
'src/wp-admin/js/code-editor.js': 'src/js/_enqueues/wp/code-editor.js',
'src/wp-admin/js/color-picker.js': 'src/js/_enqueues/lib/color-picker.js',
'src/wp-admin/js/comment.js': 'src/js/_enqueues/admin/comment.js',
'src/wp-admin/js/common.js': 'src/js/_enqueues/admin/common.js',
'src/wp-admin/js/custom-background.js': 'src/js/_enqueues/admin/custom-background.js',
'src/wp-admin/js/custom-header.js': 'src/js/_enqueues/admin/custom-header.js',
'src/wp-admin/js/customize-controls.js': 'src/js/_enqueues/wp/customize/controls.js',
'src/wp-admin/js/customize-nav-menus.js': 'src/js/_enqueues/wp/customize/nav-menus.js',
'src/wp-admin/js/customize-widgets.js': 'src/js/_enqueues/wp/customize/widgets.js',
'src/wp-admin/js/dashboard.js': 'src/js/_enqueues/wp/dashboard.js',
'src/wp-admin/js/edit-comments.js': 'src/js/_enqueues/admin/edit-comments.js',
'src/wp-admin/js/editor-expand.js': 'src/js/_enqueues/wp/editor/dfw.js',
'src/wp-admin/js/editor.js': 'src/js/_enqueues/wp/editor/base.js',
'src/wp-admin/js/gallery.js': 'src/js/_enqueues/lib/gallery.js',
'src/wp-admin/js/image-edit.js': 'src/js/_enqueues/lib/image-edit.js',
'src/wp-admin/js/inline-edit-post.js': 'src/js/_enqueues/admin/inline-edit-post.js',
'src/wp-admin/js/inline-edit-tax.js': 'src/js/_enqueues/admin/inline-edit-tax.js',
'src/wp-admin/js/language-chooser.js': 'src/js/_enqueues/lib/language-chooser.js',
'src/wp-admin/js/link.js': 'src/js/_enqueues/admin/link.js',
'src/wp-admin/js/media-gallery.js': 'src/js/_enqueues/deprecated/media-gallery.js',
'src/wp-admin/js/media-upload.js': 'src/js/_enqueues/admin/media-upload.js',
'src/wp-admin/js/media.js': 'src/js/_enqueues/admin/media.js',
'src/wp-admin/js/nav-menu.js': 'src/js/_enqueues/lib/nav-menu.js',
'src/wp-admin/js/password-strength-meter.js': 'src/js/_enqueues/wp/password-strength-meter.js',
'src/wp-admin/js/plugin-install.js': 'src/js/_enqueues/admin/plugin-install.js',
'src/wp-admin/js/post.js': 'src/js/_enqueues/admin/post.js',
'src/wp-admin/js/postbox.js': 'src/js/_enqueues/admin/postbox.js',
'src/wp-admin/js/revisions.js': 'src/js/_enqueues/wp/revisions.js',
'src/wp-admin/js/set-post-thumbnail.js': 'src/js/_enqueues/admin/set-post-thumbnail.js',
'src/wp-admin/js/svg-painter.js': 'src/js/_enqueues/wp/svg-painter.js',
'src/wp-admin/js/tags-box.js': 'src/js/_enqueues/admin/tags-box.js',
'src/wp-admin/js/tags-suggest.js': 'src/js/_enqueues/admin/tags-suggest.js',
'src/wp-admin/js/tags.js': 'src/js/_enqueues/admin/tags.js',
'src/wp-admin/js/theme-plugin-editor.js': 'src/js/_enqueues/wp/theme-plugin-editor.js',
'src/wp-admin/js/theme.js': 'src/js/_enqueues/wp/theme.js',
'src/wp-admin/js/updates.js': 'src/js/_enqueues/wp/updates.js',
'src/wp-admin/js/user-profile.js': 'src/js/_enqueues/admin/user-profile.js',
'src/wp-admin/js/user-suggest.js': 'src/js/_enqueues/lib/user-suggest.js',
'src/wp-admin/js/widgets/custom-html-widgets.js': 'src/js/_enqueues/wp/widgets/custom-html.js',
'src/wp-admin/js/widgets/media-audio-widget.js': 'src/js/_enqueues/wp/widgets/media-audio.js',
'src/wp-admin/js/widgets/media-gallery-widget.js': 'src/js/_enqueues/wp/widgets/media-gallery.js',
'src/wp-admin/js/widgets/media-image-widget.js': 'src/js/_enqueues/wp/widgets/media-image.js',
'src/wp-admin/js/widgets/media-video-widget.js': 'src/js/_enqueues/wp/widgets/media-video.js',
'src/wp-admin/js/widgets/media-widgets.js': 'src/js/_enqueues/wp/widgets/media.js',
'src/wp-admin/js/widgets/text-widgets.js': 'src/js/_enqueues/wp/widgets/text.js',
'src/wp-admin/js/widgets.js': 'src/js/_enqueues/admin/widgets.js',
'src/wp-admin/js/word-count.js': 'src/js/_enqueues/wp/utils/word-count.js',
'src/wp-admin/js/wp-fullscreen-stub.js': 'src/js/_enqueues/deprecated/fullscreen-stub.js',
'src/wp-admin/js/xfn.js': 'src/js/_enqueues/admin/xfn.js',
'src/wp-includes/js/admin-bar.js': 'src/js/_enqueues/lib/admin-bar.js',
'src/wp-includes/js/api-request.js': 'src/js/_enqueues/wp/api-request.js',
'src/wp-includes/js/autosave.js': 'src/js/_enqueues/wp/autosave.js',
'src/wp-includes/js/comment-reply.js': 'src/js/_enqueues/lib/comment-reply.js',
'src/wp-includes/js/customize-base.js': 'src/js/_enqueues/wp/customize/base.js',
'src/wp-includes/js/customize-loader.js': 'src/js/_enqueues/wp/customize/loader.js',
'src/wp-includes/js/customize-models.js': 'src/js/_enqueues/wp/customize/models.js',
'src/wp-includes/js/customize-preview-nav-menus.js': 'src/js/_enqueues/wp/customize/preview-nav-menus.js',
'src/wp-includes/js/customize-preview-widgets.js': 'src/js/_enqueues/wp/customize/preview-widgets.js',
'src/wp-includes/js/customize-preview.js': 'src/js/_enqueues/wp/customize/preview.js',
'src/wp-includes/js/customize-selective-refresh.js': 'src/js/_enqueues/wp/customize/selective-refresh.js',
'src/wp-includes/js/customize-views.js': 'src/js/_enqueues/wp/customize/views.js',
'src/wp-includes/js/heartbeat.js': 'src/js/_enqueues/wp/heartbeat.js',
'src/wp-includes/js/mce-view.js': 'src/js/_enqueues/wp/mce-view.js',
'src/wp-includes/js/media-editor.js': 'src/js/_enqueues/wp/media/editor.js',
'src/wp-includes/js/quicktags.js': 'src/js/_enqueues/lib/quicktags.js',
'src/wp-includes/js/shortcode.js': 'src/js/_enqueues/wp/shortcode.js',
'src/wp-includes/js/utils.js': 'src/js/_enqueues/lib/cookies.js',
'src/wp-includes/js/wp-a11y.js': 'src/js/_enqueues/wp/a11y.js',
'src/wp-includes/js/wp-ajax-response.js': 'src/js/_enqueues/lib/ajax-response.js',
'src/wp-includes/js/wp-api.js': 'src/js/_enqueues/wp/api.js',
'src/wp-includes/js/wp-auth-check.js': 'src/js/_enqueues/lib/auth-check.js',
'src/wp-includes/js/wp-backbone.js': 'src/js/_enqueues/wp/backbone.js',
'src/wp-includes/js/wp-custom-header.js': 'src/js/_enqueues/wp/custom-header.js',
'src/wp-includes/js/wp-embed-template.js': 'src/js/_enqueues/lib/embed-template.js',
'src/wp-includes/js/wp-embed.js': 'src/js/_enqueues/wp/embed.js',
'src/wp-includes/js/wp-emoji-loader.js': 'src/js/_enqueues/lib/emoji-loader.js',
'src/wp-includes/js/wp-emoji.js': 'src/js/_enqueues/wp/emoji.js',
'src/wp-includes/js/wp-list-revisions.js': 'src/js/_enqueues/lib/list-revisions.js',
'src/wp-includes/js/wp-lists.js': 'src/js/_enqueues/lib/lists.js',
'src/wp-includes/js/wp-pointer.js': 'src/js/_enqueues/lib/pointer.js',
'src/wp-includes/js/wp-sanitize.js': 'src/js/_enqueues/wp/sanitize.js',
'src/wp-includes/js/wp-util.js': 'src/js/_enqueues/wp/util.js',
'src/wp-includes/js/wpdialog.js': 'src/js/_enqueues/lib/dialog.js',
'src/wp-includes/js/wplink.js': 'src/js/_enqueues/lib/link.js',
'src/wp-includes/js/zxcvbn-async.js': 'src/js/_enqueues/lib/zxcvbn-async.js',
'src/wp-includes/js/media/controllers/audio-details.js' : 'src/js/media/controllers/audio-details.js',
'src/wp-includes/js/media/controllers/collection-add.js' : 'src/js/media/controllers/collection-add.js',
'src/wp-includes/js/media/controllers/collection-edit.js' : 'src/js/media/controllers/collection-edit.js',
'src/wp-includes/js/media/controllers/cropper.js' : 'src/js/media/controllers/cropper.js',
'src/wp-includes/js/media/controllers/customize-image-cropper.js' : 'src/js/media/controllers/customize-image-cropper.js',
'src/wp-includes/js/media/controllers/edit-attachment-metadata.js' : 'src/js/media/controllers/edit-attachment-metadata.js',
'src/wp-includes/js/media/controllers/edit-image.js' : 'src/js/media/controllers/edit-image.js',
'src/wp-includes/js/media/controllers/embed.js' : 'src/js/media/controllers/embed.js',
'src/wp-includes/js/media/controllers/featured-image.js' : 'src/js/media/controllers/featured-image.js',
'src/wp-includes/js/media/controllers/gallery-add.js' : 'src/js/media/controllers/gallery-add.js',
'src/wp-includes/js/media/controllers/gallery-edit.js' : 'src/js/media/controllers/gallery-edit.js',
'src/wp-includes/js/media/controllers/image-details.js' : 'src/js/media/controllers/image-details.js',
'src/wp-includes/js/media/controllers/library.js' : 'src/js/media/controllers/library.js',
'src/wp-includes/js/media/controllers/media-library.js' : 'src/js/media/controllers/media-library.js',
'src/wp-includes/js/media/controllers/region.js' : 'src/js/media/controllers/region.js',
'src/wp-includes/js/media/controllers/replace-image.js' : 'src/js/media/controllers/replace-image.js',
'src/wp-includes/js/media/controllers/site-icon-cropper.js' : 'src/js/media/controllers/site-icon-cropper.js',
'src/wp-includes/js/media/controllers/state-machine.js' : 'src/js/media/controllers/state-machine.js',
'src/wp-includes/js/media/controllers/state.js' : 'src/js/media/controllers/state.js',
'src/wp-includes/js/media/controllers/video-details.js' : 'src/js/media/controllers/video-details.js',
'src/wp-includes/js/media/models/attachment.js' : 'src/js/media/models/attachment.js',
'src/wp-includes/js/media/models/attachments.js' : 'src/js/media/models/attachments.js',
'src/wp-includes/js/media/models/post-image.js' : 'src/js/media/models/post-image.js',
'src/wp-includes/js/media/models/post-media.js' : 'src/js/media/models/post-media.js',
'src/wp-includes/js/media/models/query.js' : 'src/js/media/models/query.js',
'src/wp-includes/js/media/models/selection.js' : 'src/js/media/models/selection.js',
'src/wp-includes/js/media/routers/manage.js' : 'src/js/media/routers/manage.js',
'src/wp-includes/js/media/utils/selection-sync.js' : 'src/js/media/utils/selection-sync.js',
'src/wp-includes/js/media/views/attachment-compat.js' : 'src/js/media/views/attachment-compat.js',
'src/wp-includes/js/media/views/attachment-filters.js' : 'src/js/media/views/attachment-filters.js',
'src/wp-includes/js/media/views/attachment-filters/all.js' : 'src/js/media/views/attachment-filters/all.js',
'src/wp-includes/js/media/views/attachment-filters/date.js' : 'src/js/media/views/attachment-filters/date.js',
'src/wp-includes/js/media/views/attachment-filters/uploaded.js' : 'src/js/media/views/attachment-filters/uploaded.js',
'src/wp-includes/js/media/views/attachment.js' : 'src/js/media/views/attachment.js',
'src/wp-includes/js/media/views/attachment/details-two-column.js' : 'src/js/media/views/details-two-column.js',
'src/wp-includes/js/media/views/attachment/details.js' : 'src/js/media/views/details.js',
'src/wp-includes/js/media/views/attachment/edit-library.js' : 'src/js/media/views/edit-library.js',
'src/wp-includes/js/media/views/attachment/edit-selection.js' : 'src/js/media/views/edit-selection.js',
'src/wp-includes/js/media/views/attachment/library.js' : 'src/js/media/views/library.js',
'src/wp-includes/js/media/views/attachment/selection.js' : 'src/js/media/views/selection.js',
'src/wp-includes/js/media/views/attachment/attachments.js' : 'src/js/media/views/attachments.js',
'src/wp-includes/js/media/views/attachments/browser.js' : 'src/js/media/views/attachments/browser.js',
'src/wp-includes/js/media/views/attachments/selection.js' : 'src/js/media/views/attachments/selection.js',
'src/wp-includes/js/media/views/attachments/audio-details.js' : 'src/js/media/views/attachments/audio-details.js',
'src/wp-includes/js/media/views/attachments/button-group.js' : 'src/js/media/views/attachments/button-group.js',
'src/wp-includes/js/media/views/attachments/button.js' : 'src/js/media/views/attachments/button.js',
'src/wp-includes/js/media/views/button/delete-selected-permanently.js' : 'src/js/media/views/button/delete-selected-permanently.js',
'src/wp-includes/js/media/views/button/delete-selected.js' : 'src/js/media/views/button/delete-selected.js',
'src/wp-includes/js/media/views/button/select-mode-toggle.js' : 'src/js/media/views/button/select-mode-toggle.js',
'src/wp-includes/js/media/views/cropper.js' : 'src/js/media/views/cropper.js',
'src/wp-includes/js/media/views/edit-image-details.js' : 'src/js/media/views/edit-image-details.js',
'src/wp-includes/js/media/views/edit-image.js' : 'src/js/media/views/edit-image.js',
'src/wp-includes/js/media/views/embed.js' : 'src/js/media/views/embed.js',
'src/wp-includes/js/media/views/embed/image.js' : 'src/js/media/views/embed/image.js',
'src/wp-includes/js/media/views/embed/link.js' : 'src/js/media/views/embed/link.js',
'src/wp-includes/js/media/views/embed/url.js' : 'src/js/media/views/embed/url.js',
'src/wp-includes/js/media/views/focus-manager.js' : 'src/js/media/views/focus-manager.js',
'src/wp-includes/js/media/views/frame.js' : 'src/js/media/views/frame.js',
'src/wp-includes/js/media/views/frame/audio-details.js' : 'src/js/media/views/frame/audio-details.js',
'src/wp-includes/js/media/views/frame/edit-attachments.js' : 'src/js/media/views/frame/edit-attachments.js',
'src/wp-includes/js/media/views/frame/image-details.js' : 'src/js/media/views/frame/image-details.js',
'src/wp-includes/js/media/views/frame/manage.js' : 'src/js/media/views/frame/manage.js',
'src/wp-includes/js/media/views/frame/media-details.js' : 'src/js/media/views/frame/media-details.js',
'src/wp-includes/js/media/views/frame/post.js' : 'src/js/media/views/frame/post.js',
'src/wp-includes/js/media/views/frame/select.js' : 'src/js/media/views/frame/select.js',
'src/wp-includes/js/media/views/frame/video-details.js' : 'src/js/media/views/frame/video-details.js',
'src/wp-includes/js/media/views/iframe.js' : 'src/js/media/views/iframe.js',
'src/wp-includes/js/media/views/image-details.js' : 'src/js/media/views/image-details.js',
'src/wp-includes/js/media/views/label.js' : 'src/js/media/views/label.js',
'src/wp-includes/js/media/views/media-details.js' : 'src/js/media/views/media-details.js',
'src/wp-includes/js/media/views/media-frame.js' : 'src/js/media/views/media-frame.js',
'src/wp-includes/js/media/views/menu-item.js' : 'src/js/media/views/menu-item.js',
'src/wp-includes/js/media/views/menu.js' : 'src/js/media/views/menu.js',
'src/wp-includes/js/media/views/modal.js' : 'src/js/media/views/modal.js',
'src/wp-includes/js/media/views/priority-list.js' : 'src/js/media/views/priority-list.js',
'src/wp-includes/js/media/views/router-item.js' : 'src/js/media/views/router-item.js',
'src/wp-includes/js/media/views/router.js' : 'src/js/media/views/router.js',
'src/wp-includes/js/media/views/search.js' : 'src/js/media/views/search.js',
'src/wp-includes/js/media/views/selection.js' : 'src/js/media/views/selection.js',
'src/wp-includes/js/media/views/settings.js' : 'src/js/media/views/settings.js',
'src/wp-includes/js/media/views/settings/attachment-display.js' : 'src/js/media/views/settings/attachment-display.js',
'src/wp-includes/js/media/views/settings/gallery.js' : 'src/js/media/views/settings/gallery.js',
'src/wp-includes/js/media/views/settings/playlist.js' : 'src/js/media/views/settings/playlist.js',
'src/wp-includes/js/media/views/sidebar.js' : 'src/js/media/views/sidebar.js',
'src/wp-includes/js/media/views/site-icon-cropper.js' : 'src/js/media/views/site-icon-cropper.js',
'src/wp-includes/js/media/views/site-icon-preview.js' : 'src/js/media/views/site-icon-preview.js',
'src/wp-includes/js/media/views/spinner.js' : 'src/js/media/views/spinner.js',
'src/wp-includes/js/media/views/toolbar.js' : 'src/js/media/views/toolbar.js',
'src/wp-includes/js/media/views/toolbar/embed.js' : 'src/js/media/views/toolbar/embed.js',
'src/wp-includes/js/media/views/toolbar/select.js' : 'src/js/media/views/toolbar/select.js',
'src/wp-includes/js/media/views/uploader/editor.js' : 'src/js/media/views/uploader/editor.js',
'src/wp-includes/js/media/views/uploader/inline.js' : 'src/js/media/views/uploader/inline.js',
'src/wp-includes/js/media/views/uploader/status-error.js' : 'src/js/media/views/uploader/status-error.js',
'src/wp-includes/js/media/views/uploader/status.js' : 'src/js/media/views/uploader/status.js',
'src/wp-includes/js/media/views/uploader/window.js' : 'src/js/media/views/uploader/window.js',
'src/wp-includes/js/media/views/video-details.js' : 'src/js/media/views/video-details.js',
'src/wp-includes/js/media/views/view.js' : 'src/js/media/views/view.js'
}
}
},
jsvalidate:{ jsvalidate:{
options: { options: {
globals: {}, globals: {},
@ -616,6 +926,11 @@ module.exports = function(grunt) {
BUILD_DIR + 'wp-content/themes/twenty*/**/*.js' BUILD_DIR + 'wp-content/themes/twenty*/**/*.js'
] ]
} }
},
dynamic: {
files: {
src: []
}
} }
}, },
imagemin: { imagemin: {
@ -717,7 +1032,7 @@ module.exports = function(grunt) {
all: { all: {
files: [ files: [
SOURCE_DIR + '**', SOURCE_DIR + '**',
'!' + SOURCE_DIR + 'wp-includes/js/media/**', '!' + SOURCE_DIR + 'js/**/*.js',
// Ignore version control directories. // Ignore version control directories.
'!' + SOURCE_DIR + '**/.{svn,git}/**' '!' + SOURCE_DIR + '**/.{svn,git}/**'
], ],
@ -728,6 +1043,28 @@ module.exports = function(grunt) {
interval: 2000 interval: 2000
} }
}, },
'js-enqueues': {
files: [SOURCE_DIR + 'js/_enqueues/**/*.js'],
tasks: ['clean:dynamic', 'copy:dynamic-js', 'uglify:dynamic', 'jsvalidate:dynamic'],
options: {
dot: true,
spawn: false,
interval: 2000
}
},
'js-webpack': {
files: [
SOURCE_DIR + 'js/**/*.js',
'!' + SOURCE_DIR + 'js/_enqueues/**/*.js',
'webpack-dev.config.js'
],
tasks: ['clean:dynamic', 'webpack:dev', 'uglify:dynamic', 'jsvalidate:dynamic'],
options: {
dot: true,
spawn: false,
interval: 2000
}
},
config: { config: {
files: [ files: [
'Gruntfile.js', 'Gruntfile.js',
@ -802,8 +1139,7 @@ module.exports = function(grunt) {
grunt.registerTask( 'watch', function() { grunt.registerTask( 'watch', function() {
if ( ! this.args.length || this.args.indexOf( 'webpack' ) > -1 ) { if ( ! this.args.length || this.args.indexOf( 'webpack' ) > -1 ) {
grunt.task.run( 'build' );
grunt.task.run( 'webpack:dev' );
} }
grunt.task.run( '_' + this.nameArgs ); grunt.task.run( '_' + this.nameArgs );
@ -816,7 +1152,6 @@ module.exports = function(grunt) {
grunt.registerTask( 'precommit:js', [ grunt.registerTask( 'precommit:js', [
'webpack:prod', 'webpack:prod',
'jshint:corejs', 'jshint:corejs',
'uglify:masonry',
'uglify:imgareaselect', 'uglify:imgareaselect',
'qunit:compiled' 'qunit:compiled'
] ); ] );
@ -925,27 +1260,57 @@ module.exports = function(grunt) {
} }
} ); } );
grunt.registerTask( 'copy:js', [
'copy:npm-packages',
'copy:vendor-js',
'copy:admin-js',
'copy:includes-js'
] );
grunt.registerTask( 'uglify:all', [
'uglify:core',
'uglify:embed',
'uglify:jqueryui',
'uglify:imgareaselect'
] );
grunt.registerTask( 'build:tinymce', [
'concat:tinymce',
'compress:tinymce',
'clean:tinymce'
] );
grunt.registerTask( 'build:js', [
'clean:js',
'webpack:dev',
'copy:js',
'file_append',
'uglify:all',
'build:tinymce',
'concat:emoji',
'jsvalidate:build'
] );
grunt.registerTask( 'copy:all', [ grunt.registerTask( 'copy:all', [
'copy:files', 'copy:files',
'copy:wp-admin-css-compat-rtl', 'copy:wp-admin-css-compat-rtl',
'copy:wp-admin-css-compat-min', 'copy:wp-admin-css-compat-min',
'copy:version' 'copy:version',
'copy:js'
] ); ] );
grunt.registerTask( 'build', [ grunt.registerTask( 'build', [
'clean:all', 'clean:all',
'webpack:dev',
'copy:all', 'copy:all',
'file_append',
'cssmin:core', 'cssmin:core',
'colors', 'colors',
'rtl', 'rtl',
'cssmin:rtl', 'cssmin:rtl',
'cssmin:colors', 'cssmin:colors',
'uglify:core', 'uglify:all',
'uglify:embed', 'build:tinymce',
'uglify:jqueryui',
'concat:tinymce',
'compress:tinymce',
'clean:tinymce',
'concat:emoji', 'concat:emoji',
'includes:emoji', 'includes:emoji',
'includes:embed', 'includes:embed',
@ -994,17 +1359,84 @@ module.exports = function(grunt) {
grunt.event.on('watch', function( action, filepath, target ) { grunt.event.on('watch', function( action, filepath, target ) {
var src; var src;
if ( [ 'all', 'rtl', 'webpack' ].indexOf( target ) === -1 ) { // Only configure the dynamic tasks based on known targets.
if ( [ 'all', 'rtl', 'webpack', 'js-enqueues', 'js-webpack' ].indexOf( target ) === -1 ) {
return; return;
} }
src = [ path.relative( SOURCE_DIR, filepath ) ]; // If the target is a file in the restructured js src.
if ( target === 'js-enqueues' ) {
var files = {};
var configs, dest;
// If it's a vendor file which are configured with glob matchers.
if ( filepath.indexOf( SOURCE_DIR + 'js/_enqueues/vendor/' ) === 0 ) {
// Grab the glob matchers from the copy task.
configs = grunt.config( [ 'copy', 'vendor-js', 'files' ] );
// For each glob matcher check if it matches and if so set the variables for our dynamic tasks.
for ( var i = 0; i < configs.length; i++ ) {
var config = configs[ i ];
var relative = path.relative( config.cwd, filepath );
var minimatch = require('minimatch');
if ( minimatch.match( config.src, relative, {} ) ) {
dest = config.dest + relative;
src = [ path.relative( BUILD_DIR, dest ) ];
files[ dest ] = [ filepath ];
break;
}
}
// Or if it's another file which has a straight mapping.
} else {
configs = Object.assign( {},
grunt.config( [ 'copy', 'admin-js', 'files' ] ),
grunt.config( [ 'copy', 'includes-js', 'files' ] )
);
for ( dest in configs ) {
// If a file in the mapping matches then set the variables for our dynamic tasks.
if ( configs.hasOwnProperty( dest ) && configs[ dest ][0] === './' + filepath ) {
files[ dest ] = configs[ dest ];
src = [ path.relative( BUILD_DIR, dest ) ];
break;
}
}
}
// Configure our dynamic-js copy task which uses a file mapping rather than simply copying from src to build.
if ( action !== 'deleted' ) {
grunt.config( [ 'copy', 'dynamic-js', 'files' ], files );
}
// For the webpack builds configure the jsvalidate task to only check those files build by webpack.
} else if ( target === 'js-webpack' ) {
src = [
'wp-includes/js/media-audiovideo.js',
'wp-includes/js/media-grid.js',
'wp-includes/js/media-models.js',
'wp-includes/js/media-views.js'
];
// Else simply use the path relative to the source directory.
} else {
src = [ path.relative( SOURCE_DIR, filepath ) ];
}
if ( action === 'deleted' ) { if ( action === 'deleted' ) {
// Clean up only those files that were deleted.
grunt.config( [ 'clean', 'dynamic', 'src' ], src ); grunt.config( [ 'clean', 'dynamic', 'src' ], src );
} else { } else {
// Otherwise copy over only the changed file.
grunt.config( [ 'copy', 'dynamic', 'src' ], src ); grunt.config( [ 'copy', 'dynamic', 'src' ], src );
// For javascript also minify and validate the changed file.
if ( target === 'js-enqueues' ) {
grunt.config( [ 'uglify', 'dynamic', 'src' ], src );
grunt.config( [ 'jsvalidate', 'dynamic', 'files', 'src' ], src.map( function( dir ) { return BUILD_DIR + dir; } ) );
}
// For webpack only validate the file, minification is handled by webpack itself.
if ( target === 'js-webpack' ) {
grunt.config( [ 'jsvalidate', 'dynamic', 'files', 'src' ], src.map( function( dir ) { return BUILD_DIR + dir; } ) );
}
// For css run the rtl task on just the changed file.
if ( target === 'rtl' ) { if ( target === 'rtl' ) {
grunt.config( [ 'rtlcss', 'dynamic', 'src' ], src ); grunt.config( [ 'rtlcss', 'dynamic', 'src' ], src );
} }

11730
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,7 @@
"grunt-contrib-qunit": "^1.2.0", "grunt-contrib-qunit": "^1.2.0",
"grunt-contrib-uglify": "~2.0.0", "grunt-contrib-uglify": "~2.0.0",
"grunt-contrib-watch": "~1.0.0", "grunt-contrib-watch": "~1.0.0",
"grunt-file-append": "0.0.7",
"grunt-includes": "~0.5.1", "grunt-includes": "~0.5.1",
"grunt-jsdoc": "^2.1.0", "grunt-jsdoc": "^2.1.0",
"grunt-jsvalidate": "~0.2.2", "grunt-jsvalidate": "~0.2.2",
@ -36,8 +37,21 @@
"grunt-sass": "2.0.0", "grunt-sass": "2.0.0",
"grunt-webpack": "^3.0.2", "grunt-webpack": "^3.0.2",
"ink-docstrap": "^1.3.0", "ink-docstrap": "^1.3.0",
"jquery-migrate": "1.4.1",
"matchdep": "~1.0.0", "matchdep": "~1.0.0",
"webpack": "^3.6.0", "webpack": "^3.6.0",
"webpack-dev-server": "^2.9.1" "webpack-dev-server": "^2.9.1"
},
"dependencies": {
"backbone": "1.3.3",
"imagesloaded": "3.2.0",
"jquery": "1.12.4",
"jquery-color": "github:jquery/jquery-color#2.1.1",
"jquery-form": "4.2.1",
"jquery-hoverintent": "1.8.3",
"jquery-ui": "github:jquery/jquery-ui#1.11.4",
"masonry-layout": "3.3.2",
"twemoji": "2.5.1",
"underscore": "1.8.3"
} }
} }

17
src/_index.php Normal file
View File

@ -0,0 +1,17 @@
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );

View File

@ -1,17 +1,49 @@
<?php <?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/** /**
* Tells WordPress to load the WordPress theme and output it. * Note: this file exists only to remind developers to run WordPress from the
* * build directory. For the real index.php that gets built and boots WordPress,
* @var bool * please refer to _index.php.
*/ */
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */ /** Define ABSPATH as this file's directory */
require( dirname( __FILE__ ) . '/wp-blog-header.php' ); if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', dirname( __FILE__ ) . '/' );
}
define( 'WPINC', 'wp-includes' );
require_once( ABSPATH . WPINC . '/load.php' );
// Standardize $_SERVER variables across setups.
wp_fix_server_vars();
require_once( ABSPATH . WPINC . '/functions.php' );
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
require_once( ABSPATH . WPINC . '/version.php' );
wp_check_php_mysql_versions();
wp_load_translations_early();
// Die with an error message
$die = sprintf(
/* translators: %1$s: WordPress, %2$s: src, %3$s: build */
__( 'You seem to be running %1$s from the %2$s directory. %1$s needs to be built and run from the %3$s directory before we can get started.' ),
'WordPress',
'<code>src</code>',
'<code>build</code>'
) . '</p>';
$die .= '<p>' . sprintf(
/* translators: %s: WordPress */
__( 'You can build %s by running:' ),
'WordPress'
) . '</p>';
$die .= '<p><code>npm install && grunt build</code></p>';
$die .= '<p>' . sprintf(
/* translators: %1$s: NPM URL, %2$s: Grunt URL */
__( 'This requires <a href="%1$s">NPM</a> and <a href="%2$s">Grunt</a>. <a href="%3$s">Read more about setting up your local development environment</a>.' ),
'https://www.npmjs.com/',
'https://gruntjs.com/',
__( 'https://codex.wordpress.org/' )
) . '</p>';
wp_die( $die, __( 'WordPress &rsaquo; Error' ) );

34
src/js/_enqueues/vendor/README.md vendored Normal file
View File

@ -0,0 +1,34 @@
# src/js/enqueues/vendor
In this directory you'll find vendor JavaScript packages that cannot be installed through NPM, but are included in WordPress. Below we've documented the sources for those packages.
## Folder dependencies
- codemirror: https://github.com/codemirror/CodeMirror
- crop: http://www.defusion.org.uk/code/javascript-image-cropper-ui-using-prototype-scriptaculous/download-zip/
- imgareaselect: https://github.com/odyniec/imgareaselect
- jcrop: https://github.com/tapmodo/Jcrop
- mediaelement: https://github.com/mediaelement/mediaelement
- plupload: https://github.com/moxiecode/plupload
- swfupload: https://github.com/WordPress/secure-swfupload
- thickbox: http://codylindley.com/thickbox/
- tinymce: https://github.com/tinymce/tinymce
## Single file dependencies
- colorpicker: http://www.mattkruse.com/javascript/colorpicker/
- deprecated/suggest: Patched by Mark Jaquith with Alexander Dick's "multiple items" patch to allow for auto-suggesting of more than one tag before submitting. See documentation in `suggest.js`.
- farbtastic: https://github.com/mattfarina/farbtastic
- iris: https://github.com/Automattic/Iris
- json2: https://github.com/douglascrockford/JSON-js
- jquery/jquery.color: https://github.com/jquery/jquery-color. Package is on NPM but not published by maintainer.
- jquery/jquery.hotkeys: https://github.com/tzuryby/jquery.hotkeys
- jquery/jquery.masonry: Old version for BC purposes, can't include two versions with NPM. The newer version is included through NPM and built to `wp-includes/js/masonry.min.js`
- jquery/jquery.query: https://github.com/blairmitchelmore/jquery.plugins/blob/master/jquery.query.js
- jquery/jquery.schedule: https://github.com/rse/jquery-schedule
- jquery/jquery.serializeobject: https://github.com/cowboy/jquery-misc/blob/master/jquery.ba-serializeobject.js
- jquery/jquery.table-hotkeys: WP version can be downloaded at https://code.google.com/archive/p/js-hotkeys/downloads?page=2. A newer version is available at https://github.com/jeresig/jquery.hotkeys.
- jquery/jquery.ui.touch-punch.js https://github.com/furf/jquery-ui-touch-punch/blob/master/jquery.ui.touch-punch.js
- swfobject: https://github.com/swfobject/swfobject
- tw-sack: https://github.com/abritinthebay/simpleajaxcodekit
- zxcvbn: https://github.com/dropbox/zxcvbn cannot automatically be installed as the frequency lists need to be manually ROT13 transformed.

View File

Before

Width:  |  Height:  |  Size: 277 B

After

Width:  |  Height:  |  Size: 277 B

View File

Before

Width:  |  Height:  |  Size: 293 B

After

Width:  |  Height:  |  Size: 293 B

View File

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 178 B

View File

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 178 B

View File

Before

Width:  |  Height:  |  Size: 323 B

After

Width:  |  Height:  |  Size: 323 B

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Some files were not shown because too many files have changed in this diff Show More