Ticket #44492: build-into-src.2.diff
File build-into-src.2.diff, 42.5 KB (added by , 6 years ago) |
---|
-
Gruntfile.js
8 8 spawn = require( 'child_process' ).spawnSync, 9 9 SOURCE_DIR = 'src/', 10 10 BUILD_DIR = 'build/', 11 WORKING_DIR = grunt.option( 'dev' ) ? SOURCE_DIR : BUILD_DIR, 11 12 BANNER_TEXT = '/*! This file is auto-generated */', 12 13 autoprefixer = require( 'autoprefixer' ), 13 14 nodesass = require( 'node-sass' ), … … 24 25 'wp-content/plugins/index.php', 25 26 'wp-content/plugins/hello.php', 26 27 'wp-content/plugins/akismet/**' 27 ], 28 cleanFiles = [], 29 changedFiles = { 30 php: [] 31 }; 28 ]; 32 29 33 buildFiles.forEach( function( buildFile ) {34 cleanFiles.push( BUILD_DIR + buildFile );35 } );36 37 30 if ( 'watch:phpunit' === grunt.cli.tasks[ 0 ] && ! phpUnitWatchGroup ) { 38 31 grunt.log.writeln(); 39 32 grunt.fail.fatal( … … 81 74 }, 82 75 colors: { 83 76 expand: true, 84 cwd: BUILD_DIR,85 dest: BUILD_DIR,77 cwd: WORKING_DIR, 78 dest: WORKING_DIR, 86 79 src: [ 87 80 'wp-admin/css/colors/*/colors.css' 88 81 ] … … 96 89 }, 97 90 files: { 98 91 src: [ 99 BUILD_DIR + 'wp-admin/css/*.min.css',100 BUILD_DIR + 'wp-includes/css/*.min.css',101 BUILD_DIR + 'wp-admin/css/colors/*/*.css'92 WORKING_DIR + 'wp-admin/css/*.min.css', 93 WORKING_DIR + 'wp-includes/css/*.min.css', 94 WORKING_DIR + 'wp-admin/css/colors/*/*.css' 102 95 ] 103 96 } 104 97 }, … … 105 98 clean: { 106 99 plugins: [BUILD_DIR + 'wp-content/plugins'], 107 100 themes: [BUILD_DIR + 'wp-content/themes'], 108 all: [ 109 cleanFiles, 110 SOURCE_DIR + 'wp-includes/js/dist', 111 SOURCE_DIR + 'wp-includes/css/dist' 101 files: buildFiles.map( function( file ) { 102 return BUILD_DIR + file; 103 }), 104 css: [ 105 WORKING_DIR + 'wp-admin/css/*.min.css', 106 WORKING_DIR + 'wp-admin/css/*rtl*', 107 WORKING_DIR + 'wp-includes/css/*.min.css', 108 WORKING_DIR + 'wp-includes/css/*rtl*', 109 WORKING_DIR + 'wp-admin/css/colors/**/*.css' 112 110 ], 113 js: [BUILD_DIR + 'wp-admin/js/', BUILD_DIR + 'wp-includes/js/'], 111 js: [ 112 WORKING_DIR + 'wp-admin/js/', 113 WORKING_DIR + 'wp-includes/js/' 114 ], 114 115 dynamic: { 115 116 dot: true, 116 117 expand: true, 117 cwd: BUILD_DIR,118 cwd: WORKING_DIR, 118 119 src: [] 119 120 }, 120 121 tinymce: ['<%= concat.tinymce.dest %>'], … … 125 126 files: [ 126 127 { 127 128 append: 'jQuery.noConflict();', 128 input: './build/wp-includes/js/jquery/jquery.js',129 output: './build/wp-includes/js/jquery/jquery.js'129 input: WORKING_DIR + 'wp-includes/js/jquery/jquery.js', 130 output: WORKING_DIR + 'wp-includes/js/jquery/jquery.js' 130 131 } 131 132 ] 132 133 } … … 153 154 dest: BUILD_DIR 154 155 }, 155 156 { 156 'build/index.php': ['src/_index.php'],157 'build/wp-admin/index.php': ['src/wp-admin/_index.php']157 [BUILD_DIR + 'index.php']: ['src/_index.php'], 158 [BUILD_DIR + 'wp-admin/index.php']: ['src/wp-admin/_index.php'] 158 159 } 159 160 ] 160 161 }, 161 162 'npm-packages': { 162 163 files: { 163 'build/wp-includes/js/backbone.js': ['./node_modules/backbone/backbone.js'],164 'build/wp-includes/js/hoverIntent.js': ['./node_modules/jquery-hoverintent/jquery.hoverIntent.js'],165 'build/wp-includes/js/imagesloaded.min.js': ['./node_modules/imagesloaded/imagesloaded.pkgd.min.js'],166 'build/wp-includes/js/jquery/jquery-migrate.js': ['./node_modules/jquery-migrate/dist/jquery-migrate.js'],167 'build/wp-includes/js/jquery/jquery-migrate.min.js': ['./node_modules/jquery-migrate/dist/jquery-migrate.min.js'],168 'build/wp-includes/js/jquery/jquery.form.js': ['./node_modules/jquery-form/src/jquery.form.js'],169 'build/wp-includes/js/jquery/jquery.form.min.js': ['./node_modules/jquery-form/dist/jquery.form.min.js'],170 'build/wp-includes/js/jquery/jquery.js': ['./node_modules/jquery/dist/jquery.min.js'],171 'build/wp-includes/js/masonry.min.js': ['./node_modules/masonry-layout/dist/masonry.pkgd.min.js'],172 'build/wp-includes/js/twemoji.js': ['./node_modules/twemoji/2/twemoji.js'],173 'build/wp-includes/js/underscore.min.js': ['./node_modules/underscore/underscore-min.js']164 [ WORKING_DIR + 'wp-includes/js/backbone.js' ]: [ './node_modules/backbone/backbone.js' ], 165 [ WORKING_DIR + 'wp-includes/js/hoverIntent.js' ]: [ './node_modules/jquery-hoverintent/jquery.hoverIntent.js' ], 166 [ WORKING_DIR + 'wp-includes/js/imagesloaded.min.js' ]: [ './node_modules/imagesloaded/imagesloaded.pkgd.min.js' ], 167 [ WORKING_DIR + 'wp-includes/js/jquery/jquery-migrate.js' ]: [ './node_modules/jquery-migrate/dist/jquery-migrate.js' ], 168 [ WORKING_DIR + 'wp-includes/js/jquery/jquery-migrate.min.js' ]: [ './node_modules/jquery-migrate/dist/jquery-migrate.min.js' ], 169 [ WORKING_DIR + 'wp-includes/js/jquery/jquery.form.js' ]: [ './node_modules/jquery-form/src/jquery.form.js' ], 170 [ WORKING_DIR + 'wp-includes/js/jquery/jquery.form.min.js' ]: [ './node_modules/jquery-form/dist/jquery.form.min.js' ], 171 [ WORKING_DIR + 'wp-includes/js/jquery/jquery.js' ]: [ './node_modules/jquery/dist/jquery.min.js' ], 172 [ WORKING_DIR + 'wp-includes/js/masonry.min.js' ]: [ './node_modules/masonry-layout/dist/masonry.pkgd.min.js' ], 173 [ WORKING_DIR + 'wp-includes/js/twemoji.js' ]: [ './node_modules/twemoji/2/twemoji.js' ], 174 [ WORKING_DIR + 'wp-includes/js/underscore.min.js' ]: [ './node_modules/underscore/underscore-min.js' ] 174 175 } 175 176 }, 176 177 'vendor-js': { … … 188 189 '!jquery/jquery.masonry.js', 189 190 '!tinymce/tinymce.js' 190 191 ], 191 dest: 'build/wp-includes/js/'192 dest: WORKING_DIR + 'wp-includes/js/' 192 193 }, 193 194 { 194 195 expand: true, … … 197 198 'farbtastic.js', 198 199 'iris.min.js' 199 200 ], 200 dest: 'build/wp-admin/js/'201 dest: WORKING_DIR + 'wp-admin/js/' 201 202 }, 202 203 { 203 204 expand: true, … … 205 206 src: [ 206 207 'suggest*' 207 208 ], 208 dest: 'build/wp-includes/js/jquery/'209 dest: WORKING_DIR + 'wp-includes/js/jquery/' 209 210 } 210 211 ] 211 212 }, 212 213 'admin-js': { 213 214 files: { 214 'build/wp-admin/js/accordion.js': ['./src/js/_enqueues/lib/accordion.js'],215 'build/wp-admin/js/code-editor.js': ['./src/js/_enqueues/wp/code-editor.js'],216 'build/wp-admin/js/color-picker.js': ['./src/js/_enqueues/lib/color-picker.js'],217 'build/wp-admin/js/comment.js': ['./src/js/_enqueues/admin/comment.js'],218 'build/wp-admin/js/common.js': ['./src/js/_enqueues/admin/common.js'],219 'build/wp-admin/js/custom-background.js': ['./src/js/_enqueues/admin/custom-background.js'],220 'build/wp-admin/js/custom-header.js': ['./src/js/_enqueues/admin/custom-header.js'],221 'build/wp-admin/js/customize-controls.js': ['./src/js/_enqueues/wp/customize/controls.js'],222 'build/wp-admin/js/customize-nav-menus.js': ['./src/js/_enqueues/wp/customize/nav-menus.js'],223 'build/wp-admin/js/customize-widgets.js': ['./src/js/_enqueues/wp/customize/widgets.js'],224 'build/wp-admin/js/dashboard.js': ['./src/js/_enqueues/wp/dashboard.js'],225 'build/wp-admin/js/edit-comments.js': ['./src/js/_enqueues/admin/edit-comments.js'],226 'build/wp-admin/js/editor-expand.js': ['./src/js/_enqueues/wp/editor/dfw.js'],227 'build/wp-admin/js/editor.js': ['./src/js/_enqueues/wp/editor/base.js'],228 'build/wp-admin/js/gallery.js': ['./src/js/_enqueues/lib/gallery.js'],229 'build/wp-admin/js/image-edit.js': ['./src/js/_enqueues/lib/image-edit.js'],230 'build/wp-admin/js/inline-edit-post.js': ['./src/js/_enqueues/admin/inline-edit-post.js'],231 'build/wp-admin/js/inline-edit-tax.js': ['./src/js/_enqueues/admin/inline-edit-tax.js'],232 'build/wp-admin/js/language-chooser.js': ['./src/js/_enqueues/lib/language-chooser.js'],233 'build/wp-admin/js/link.js': ['./src/js/_enqueues/admin/link.js'],234 'build/wp-admin/js/media-gallery.js': ['./src/js/_enqueues/deprecated/media-gallery.js'],235 'build/wp-admin/js/media-upload.js': ['./src/js/_enqueues/admin/media-upload.js'],236 'build/wp-admin/js/media.js': ['./src/js/_enqueues/admin/media.js'],237 'build/wp-admin/js/nav-menu.js': ['./src/js/_enqueues/lib/nav-menu.js'],238 'build/wp-admin/js/password-strength-meter.js': ['./src/js/_enqueues/wp/password-strength-meter.js'],239 'build/wp-admin/js/plugin-install.js': ['./src/js/_enqueues/admin/plugin-install.js'],240 'build/wp-admin/js/post.js': ['./src/js/_enqueues/admin/post.js'],241 'build/wp-admin/js/postbox.js': ['./src/js/_enqueues/admin/postbox.js'],242 'build/wp-admin/js/revisions.js': ['./src/js/_enqueues/wp/revisions.js'],243 'build/wp-admin/js/set-post-thumbnail.js': ['./src/js/_enqueues/admin/set-post-thumbnail.js'],244 'build/wp-admin/js/svg-painter.js': ['./src/js/_enqueues/wp/svg-painter.js'],245 'build/wp-admin/js/tags-box.js': ['./src/js/_enqueues/admin/tags-box.js'],246 'build/wp-admin/js/tags-suggest.js': ['./src/js/_enqueues/admin/tags-suggest.js'],247 'build/wp-admin/js/tags.js': ['./src/js/_enqueues/admin/tags.js'],248 'build/wp-admin/js/theme-plugin-editor.js': ['./src/js/_enqueues/wp/theme-plugin-editor.js'],249 'build/wp-admin/js/theme.js': ['./src/js/_enqueues/wp/theme.js'],250 'build/wp-admin/js/updates.js': ['./src/js/_enqueues/wp/updates.js'],251 'build/wp-admin/js/user-profile.js': ['./src/js/_enqueues/admin/user-profile.js'],252 'build/wp-admin/js/user-suggest.js': ['./src/js/_enqueues/lib/user-suggest.js'],253 'build/wp-admin/js/widgets/custom-html-widgets.js': ['./src/js/_enqueues/wp/widgets/custom-html.js'],254 'build/wp-admin/js/widgets/media-audio-widget.js': ['./src/js/_enqueues/wp/widgets/media-audio.js'],255 'build/wp-admin/js/widgets/media-gallery-widget.js': ['./src/js/_enqueues/wp/widgets/media-gallery.js'],256 'build/wp-admin/js/widgets/media-image-widget.js': ['./src/js/_enqueues/wp/widgets/media-image.js'],257 'build/wp-admin/js/widgets/media-video-widget.js': ['./src/js/_enqueues/wp/widgets/media-video.js'],258 'build/wp-admin/js/widgets/media-widgets.js': ['./src/js/_enqueues/wp/widgets/media.js'],259 'build/wp-admin/js/widgets/text-widgets.js': ['./src/js/_enqueues/wp/widgets/text.js'],260 'build/wp-admin/js/widgets.js': ['./src/js/_enqueues/admin/widgets.js'],261 'build/wp-admin/js/word-count.js': ['./src/js/_enqueues/wp/utils/word-count.js'],262 'build/wp-admin/js/wp-fullscreen-stub.js': ['./src/js/_enqueues/deprecated/fullscreen-stub.js'],263 'build/wp-admin/js/xfn.js': ['./src/js/_enqueues/admin/xfn.js']215 [ WORKING_DIR + 'wp-admin/js/accordion.js' ]: [ './src/js/_enqueues/lib/accordion.js' ], 216 [ WORKING_DIR + 'wp-admin/js/code-editor.js' ]: [ './src/js/_enqueues/wp/code-editor.js' ], 217 [ WORKING_DIR + 'wp-admin/js/color-picker.js' ]: [ './src/js/_enqueues/lib/color-picker.js' ], 218 [ WORKING_DIR + 'wp-admin/js/comment.js' ]: [ './src/js/_enqueues/admin/comment.js' ], 219 [ WORKING_DIR + 'wp-admin/js/common.js' ]: [ './src/js/_enqueues/admin/common.js' ], 220 [ WORKING_DIR + 'wp-admin/js/custom-background.js' ]: [ './src/js/_enqueues/admin/custom-background.js' ], 221 [ WORKING_DIR + 'wp-admin/js/custom-header.js' ]: [ './src/js/_enqueues/admin/custom-header.js' ], 222 [ WORKING_DIR + 'wp-admin/js/customize-controls.js' ]: [ './src/js/_enqueues/wp/customize/controls.js' ], 223 [ WORKING_DIR + 'wp-admin/js/customize-nav-menus.js' ]: [ './src/js/_enqueues/wp/customize/nav-menus.js' ], 224 [ WORKING_DIR + 'wp-admin/js/customize-widgets.js' ]: [ './src/js/_enqueues/wp/customize/widgets.js' ], 225 [ WORKING_DIR + 'wp-admin/js/dashboard.js' ]: [ './src/js/_enqueues/wp/dashboard.js' ], 226 [ WORKING_DIR + 'wp-admin/js/edit-comments.js' ]: [ './src/js/_enqueues/admin/edit-comments.js' ], 227 [ WORKING_DIR + 'wp-admin/js/editor-expand.js' ]: [ './src/js/_enqueues/wp/editor/dfw.js' ], 228 [ WORKING_DIR + 'wp-admin/js/editor.js' ]: [ './src/js/_enqueues/wp/editor/base.js' ], 229 [ WORKING_DIR + 'wp-admin/js/gallery.js' ]: [ './src/js/_enqueues/lib/gallery.js' ], 230 [ WORKING_DIR + 'wp-admin/js/image-edit.js' ]: [ './src/js/_enqueues/lib/image-edit.js' ], 231 [ WORKING_DIR + 'wp-admin/js/inline-edit-post.js' ]: [ './src/js/_enqueues/admin/inline-edit-post.js' ], 232 [ WORKING_DIR + 'wp-admin/js/inline-edit-tax.js' ]: [ './src/js/_enqueues/admin/inline-edit-tax.js' ], 233 [ WORKING_DIR + 'wp-admin/js/language-chooser.js' ]: [ './src/js/_enqueues/lib/language-chooser.js' ], 234 [ WORKING_DIR + 'wp-admin/js/link.js' ]: [ './src/js/_enqueues/admin/link.js' ], 235 [ WORKING_DIR + 'wp-admin/js/media-gallery.js' ]: [ './src/js/_enqueues/deprecated/media-gallery.js' ], 236 [ WORKING_DIR + 'wp-admin/js/media-upload.js' ]: [ './src/js/_enqueues/admin/media-upload.js' ], 237 [ WORKING_DIR + 'wp-admin/js/media.js' ]: [ './src/js/_enqueues/admin/media.js' ], 238 [ WORKING_DIR + 'wp-admin/js/nav-menu.js' ]: [ './src/js/_enqueues/lib/nav-menu.js' ], 239 [ WORKING_DIR + 'wp-admin/js/password-strength-meter.js' ]: [ './src/js/_enqueues/wp/password-strength-meter.js' ], 240 [ WORKING_DIR + 'wp-admin/js/plugin-install.js' ]: [ './src/js/_enqueues/admin/plugin-install.js' ], 241 [ WORKING_DIR + 'wp-admin/js/post.js' ]: [ './src/js/_enqueues/admin/post.js' ], 242 [ WORKING_DIR + 'wp-admin/js/postbox.js' ]: [ './src/js/_enqueues/admin/postbox.js' ], 243 [ WORKING_DIR + 'wp-admin/js/revisions.js' ]: [ './src/js/_enqueues/wp/revisions.js' ], 244 [ WORKING_DIR + 'wp-admin/js/set-post-thumbnail.js' ]: [ './src/js/_enqueues/admin/set-post-thumbnail.js' ], 245 [ WORKING_DIR + 'wp-admin/js/svg-painter.js' ]: [ './src/js/_enqueues/wp/svg-painter.js' ], 246 [ WORKING_DIR + 'wp-admin/js/tags-box.js' ]: [ './src/js/_enqueues/admin/tags-box.js' ], 247 [ WORKING_DIR + 'wp-admin/js/tags-suggest.js' ]: [ './src/js/_enqueues/admin/tags-suggest.js' ], 248 [ WORKING_DIR + 'wp-admin/js/tags.js' ]: [ './src/js/_enqueues/admin/tags.js' ], 249 [ WORKING_DIR + 'wp-admin/js/theme-plugin-editor.js' ]: [ './src/js/_enqueues/wp/theme-plugin-editor.js' ], 250 [ WORKING_DIR + 'wp-admin/js/theme.js' ]: [ './src/js/_enqueues/wp/theme.js' ], 251 [ WORKING_DIR + 'wp-admin/js/updates.js' ]: [ './src/js/_enqueues/wp/updates.js' ], 252 [ WORKING_DIR + 'wp-admin/js/user-profile.js' ]: [ './src/js/_enqueues/admin/user-profile.js' ], 253 [ WORKING_DIR + 'wp-admin/js/user-suggest.js' ]: [ './src/js/_enqueues/lib/user-suggest.js' ], 254 [ WORKING_DIR + 'wp-admin/js/widgets/custom-html-widgets.js' ]: [ './src/js/_enqueues/wp/widgets/custom-html.js' ], 255 [ WORKING_DIR + 'wp-admin/js/widgets/media-audio-widget.js' ]: [ './src/js/_enqueues/wp/widgets/media-audio.js' ], 256 [ WORKING_DIR + 'wp-admin/js/widgets/media-gallery-widget.js' ]: [ './src/js/_enqueues/wp/widgets/media-gallery.js' ], 257 [ WORKING_DIR + 'wp-admin/js/widgets/media-image-widget.js' ]: [ './src/js/_enqueues/wp/widgets/media-image.js' ], 258 [ WORKING_DIR + 'wp-admin/js/widgets/media-video-widget.js' ]: [ './src/js/_enqueues/wp/widgets/media-video.js' ], 259 [ WORKING_DIR + 'wp-admin/js/widgets/media-widgets.js' ]: [ './src/js/_enqueues/wp/widgets/media.js' ], 260 [ WORKING_DIR + 'wp-admin/js/widgets/text-widgets.js' ]: [ './src/js/_enqueues/wp/widgets/text.js' ], 261 [ WORKING_DIR + 'wp-admin/js/widgets.js' ]: [ './src/js/_enqueues/admin/widgets.js' ], 262 [ WORKING_DIR + 'wp-admin/js/word-count.js' ]: [ './src/js/_enqueues/wp/utils/word-count.js' ], 263 [ WORKING_DIR + 'wp-admin/js/wp-fullscreen-stub.js' ]: [ './src/js/_enqueues/deprecated/fullscreen-stub.js' ], 264 [ WORKING_DIR + 'wp-admin/js/xfn.js' ]: [ './src/js/_enqueues/admin/xfn.js' ] 264 265 } 265 266 }, 266 267 'includes-js': { 267 268 files: { 268 'build/wp-includes/js/admin-bar.js': ['./src/js/_enqueues/lib/admin-bar.js'],269 'build/wp-includes/js/api-request.js': ['./src/js/_enqueues/wp/api-request.js'],270 'build/wp-includes/js/autosave.js': ['./src/js/_enqueues/wp/autosave.js'],271 'build/wp-includes/js/comment-reply.js': ['./src/js/_enqueues/lib/comment-reply.js'],272 'build/wp-includes/js/customize-base.js': ['./src/js/_enqueues/wp/customize/base.js'],273 'build/wp-includes/js/customize-loader.js': ['./src/js/_enqueues/wp/customize/loader.js'],274 'build/wp-includes/js/customize-models.js': ['./src/js/_enqueues/wp/customize/models.js'],275 'build/wp-includes/js/customize-preview-nav-menus.js': ['./src/js/_enqueues/wp/customize/preview-nav-menus.js'],276 'build/wp-includes/js/customize-preview-widgets.js': ['./src/js/_enqueues/wp/customize/preview-widgets.js'],277 'build/wp-includes/js/customize-preview.js': ['./src/js/_enqueues/wp/customize/preview.js'],278 'build/wp-includes/js/customize-selective-refresh.js': ['./src/js/_enqueues/wp/customize/selective-refresh.js'],279 'build/wp-includes/js/customize-views.js': ['./src/js/_enqueues/wp/customize/views.js'],280 'build/wp-includes/js/heartbeat.js': ['./src/js/_enqueues/wp/heartbeat.js'],281 'build/wp-includes/js/mce-view.js': ['./src/js/_enqueues/wp/mce-view.js'],282 'build/wp-includes/js/media-editor.js': ['./src/js/_enqueues/wp/media/editor.js'],283 'build/wp-includes/js/quicktags.js': ['./src/js/_enqueues/lib/quicktags.js'],284 'build/wp-includes/js/shortcode.js': ['./src/js/_enqueues/wp/shortcode.js'],285 'build/wp-includes/js/utils.js': ['./src/js/_enqueues/lib/cookies.js'],286 'build/wp-includes/js/wp-a11y.js': ['./src/js/_enqueues/wp/a11y.js'],287 'build/wp-includes/js/wp-ajax-response.js': ['./src/js/_enqueues/lib/ajax-response.js'],288 'build/wp-includes/js/wp-api.js': ['./src/js/_enqueues/wp/api.js'],289 'build/wp-includes/js/wp-auth-check.js': ['./src/js/_enqueues/lib/auth-check.js'],290 'build/wp-includes/js/wp-backbone.js': ['./src/js/_enqueues/wp/backbone.js'],291 'build/wp-includes/js/wp-custom-header.js': ['./src/js/_enqueues/wp/custom-header.js'],292 'build/wp-includes/js/wp-embed-template.js': ['./src/js/_enqueues/lib/embed-template.js'],293 'build/wp-includes/js/wp-embed.js': ['./src/js/_enqueues/wp/embed.js'],294 'build/wp-includes/js/wp-emoji-loader.js': ['./src/js/_enqueues/lib/emoji-loader.js'],295 'build/wp-includes/js/wp-emoji.js': ['./src/js/_enqueues/wp/emoji.js'],296 'build/wp-includes/js/wp-list-revisions.js': ['./src/js/_enqueues/lib/list-revisions.js'],297 'build/wp-includes/js/wp-lists.js': ['./src/js/_enqueues/lib/lists.js'],298 'build/wp-includes/js/wp-pointer.js': ['./src/js/_enqueues/lib/pointer.js'],299 'build/wp-includes/js/wp-sanitize.js': ['./src/js/_enqueues/wp/sanitize.js'],300 'build/wp-includes/js/wp-util.js': ['./src/js/_enqueues/wp/util.js'],301 'build/wp-includes/js/wpdialog.js': ['./src/js/_enqueues/lib/dialog.js'],302 'build/wp-includes/js/wplink.js': ['./src/js/_enqueues/lib/link.js'],303 'build/wp-includes/js/zxcvbn-async.js': ['./src/js/_enqueues/lib/zxcvbn-async.js']269 [ WORKING_DIR + 'wp-includes/js/admin-bar.js' ]: [ './src/js/_enqueues/lib/admin-bar.js' ], 270 [ WORKING_DIR + 'wp-includes/js/api-request.js' ]: [ './src/js/_enqueues/wp/api-request.js' ], 271 [ WORKING_DIR + 'wp-includes/js/autosave.js' ]: [ './src/js/_enqueues/wp/autosave.js' ], 272 [ WORKING_DIR + 'wp-includes/js/comment-reply.js' ]: [ './src/js/_enqueues/lib/comment-reply.js' ], 273 [ WORKING_DIR + 'wp-includes/js/customize-base.js' ]: [ './src/js/_enqueues/wp/customize/base.js' ], 274 [ WORKING_DIR + 'wp-includes/js/customize-loader.js' ]: [ './src/js/_enqueues/wp/customize/loader.js' ], 275 [ WORKING_DIR + 'wp-includes/js/customize-models.js' ]: [ './src/js/_enqueues/wp/customize/models.js' ], 276 [ WORKING_DIR + 'wp-includes/js/customize-preview-nav-menus.js' ]: [ './src/js/_enqueues/wp/customize/preview-nav-menus.js' ], 277 [ WORKING_DIR + 'wp-includes/js/customize-preview-widgets.js' ]: [ './src/js/_enqueues/wp/customize/preview-widgets.js' ], 278 [ WORKING_DIR + 'wp-includes/js/customize-preview.js' ]: [ './src/js/_enqueues/wp/customize/preview.js' ], 279 [ WORKING_DIR + 'wp-includes/js/customize-selective-refresh.js' ]: [ './src/js/_enqueues/wp/customize/selective-refresh.js' ], 280 [ WORKING_DIR + 'wp-includes/js/customize-views.js' ]: [ './src/js/_enqueues/wp/customize/views.js' ], 281 [ WORKING_DIR + 'wp-includes/js/heartbeat.js' ]: [ './src/js/_enqueues/wp/heartbeat.js' ], 282 [ WORKING_DIR + 'wp-includes/js/mce-view.js' ]: [ './src/js/_enqueues/wp/mce-view.js' ], 283 [ WORKING_DIR + 'wp-includes/js/media-editor.js' ]: [ './src/js/_enqueues/wp/media/editor.js' ], 284 [ WORKING_DIR + 'wp-includes/js/quicktags.js' ]: [ './src/js/_enqueues/lib/quicktags.js' ], 285 [ WORKING_DIR + 'wp-includes/js/shortcode.js' ]: [ './src/js/_enqueues/wp/shortcode.js' ], 286 [ WORKING_DIR + 'wp-includes/js/utils.js' ]: [ './src/js/_enqueues/lib/cookies.js' ], 287 [ WORKING_DIR + 'wp-includes/js/wp-a11y.js' ]: [ './src/js/_enqueues/wp/a11y.js' ], 288 [ WORKING_DIR + 'wp-includes/js/wp-ajax-response.js' ]: [ './src/js/_enqueues/lib/ajax-response.js' ], 289 [ WORKING_DIR + 'wp-includes/js/wp-api.js' ]: [ './src/js/_enqueues/wp/api.js' ], 290 [ WORKING_DIR + 'wp-includes/js/wp-auth-check.js' ]: [ './src/js/_enqueues/lib/auth-check.js' ], 291 [ WORKING_DIR + 'wp-includes/js/wp-backbone.js' ]: [ './src/js/_enqueues/wp/backbone.js' ], 292 [ WORKING_DIR + 'wp-includes/js/wp-custom-header.js' ]: [ './src/js/_enqueues/wp/custom-header.js' ], 293 [ WORKING_DIR + 'wp-includes/js/wp-embed-template.js' ]: [ './src/js/_enqueues/lib/embed-template.js' ], 294 [ WORKING_DIR + 'wp-includes/js/wp-embed.js' ]: [ './src/js/_enqueues/wp/embed.js' ], 295 [ WORKING_DIR + 'wp-includes/js/wp-emoji-loader.js' ]: [ './src/js/_enqueues/lib/emoji-loader.js' ], 296 [ WORKING_DIR + 'wp-includes/js/wp-emoji.js' ]: [ './src/js/_enqueues/wp/emoji.js' ], 297 [ WORKING_DIR + 'wp-includes/js/wp-list-revisions.js' ]: [ './src/js/_enqueues/lib/list-revisions.js' ], 298 [ WORKING_DIR + 'wp-includes/js/wp-lists.js' ]: [ './src/js/_enqueues/lib/lists.js' ], 299 [ WORKING_DIR + 'wp-includes/js/wp-pointer.js' ]: [ './src/js/_enqueues/lib/pointer.js' ], 300 [ WORKING_DIR + 'wp-includes/js/wp-sanitize.js' ]: [ './src/js/_enqueues/wp/sanitize.js' ], 301 [ WORKING_DIR + 'wp-includes/js/wp-util.js' ]: [ './src/js/_enqueues/wp/util.js' ], 302 [ WORKING_DIR + 'wp-includes/js/wpdialog.js' ]: [ './src/js/_enqueues/lib/dialog.js' ], 303 [ WORKING_DIR + 'wp-includes/js/wplink.js' ]: [ './src/js/_enqueues/lib/link.js' ], 304 [ WORKING_DIR + 'wp-includes/js/zxcvbn-async.js' ]: [ './src/js/_enqueues/lib/zxcvbn-async.js' ] 304 305 } 305 306 }, 306 307 'wp-admin-css-compat-rtl': { … … 310 311 } 311 312 }, 312 313 src: SOURCE_DIR + 'wp-admin/css/wp-admin.css', 313 dest: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.css'314 dest: WORKING_DIR + 'wp-admin/css/wp-admin-rtl.css' 314 315 }, 315 316 'wp-admin-css-compat-min': { 316 317 options: { … … 321 322 files: [ 322 323 { 323 324 src: SOURCE_DIR + 'wp-admin/css/wp-admin.css', 324 dest: BUILD_DIR + 'wp-admin/css/wp-admin.min.css'325 dest: WORKING_DIR + 'wp-admin/css/wp-admin.min.css' 325 326 }, 326 327 { 327 src: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.css',328 dest: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.min.css'328 src: WORKING_DIR + 'wp-admin/css/wp-admin-rtl.css', 329 dest: WORKING_DIR + 'wp-admin/css/wp-admin-rtl.min.css' 329 330 } 330 331 ] 331 332 }, … … 350 351 dot: true, 351 352 expand: true, 352 353 cwd: SOURCE_DIR, 353 dest: BUILD_DIR,354 dest: WORKING_DIR, 354 355 src: [] 355 356 }, 356 357 'dynamic-js': { … … 373 374 colors: { 374 375 expand: true, 375 376 cwd: SOURCE_DIR, 376 dest: BUILD_DIR,377 dest: WORKING_DIR, 377 378 ext: '.css', 378 379 src: ['wp-admin/css/colors/*/colors.scss'], 379 380 options: { … … 388 389 }, 389 390 core: { 390 391 expand: true, 391 cwd: BUILD_DIR,392 dest: BUILD_DIR,392 cwd: WORKING_DIR, 393 dest: WORKING_DIR, 393 394 ext: '.min.css', 394 395 src: [ 395 396 'wp-admin/css/*.css', … … 400 401 }, 401 402 dist: { 402 403 expand: true, 403 cwd: BUILD_DIR,404 dest: BUILD_DIR,404 cwd: WORKING_DIR, 405 dest: WORKING_DIR, 405 406 ext: '.min.css', 406 407 src: [ 407 408 'wp-includes/css/dist/*/*.css' … … 409 410 }, 410 411 rtl: { 411 412 expand: true, 412 cwd: BUILD_DIR,413 dest: BUILD_DIR,413 cwd: WORKING_DIR, 414 dest: WORKING_DIR, 414 415 ext: '.min.css', 415 416 src: [ 416 417 'wp-admin/css/*-rtl.css', … … 420 421 }, 421 422 colors: { 422 423 expand: true, 423 cwd: BUILD_DIR,424 dest: BUILD_DIR,424 cwd: WORKING_DIR, 425 dest: WORKING_DIR, 425 426 ext: '.min.css', 426 427 src: [ 427 428 'wp-admin/css/colors/*/*.css' … … 484 485 core: { 485 486 expand: true, 486 487 cwd: SOURCE_DIR, 487 dest: BUILD_DIR,488 dest: WORKING_DIR, 488 489 ext: '-rtl.css', 489 490 src: [ 490 491 'wp-admin/css/*.css', … … 498 499 }, 499 500 colors: { 500 501 expand: true, 501 cwd: BUILD_DIR,502 dest: BUILD_DIR,502 cwd: WORKING_DIR, 503 dest: WORKING_DIR, 503 504 ext: '-rtl.css', 504 505 src: [ 505 506 'wp-admin/css/colors/*/colors.css' … … 508 509 dynamic: { 509 510 expand: true, 510 511 cwd: SOURCE_DIR, 511 dest: BUILD_DIR,512 dest: WORKING_DIR, 512 513 ext: '-rtl.css', 513 514 src: [] 514 515 } … … 662 663 }, 663 664 core: { 664 665 expand: true, 665 cwd: BUILD_DIR,666 dest: BUILD_DIR,666 cwd: WORKING_DIR, 667 dest: WORKING_DIR, 667 668 ext: '.min.js', 668 669 src: [ 669 670 'wp-admin/js/**/*.js', … … 690 691 } 691 692 }, 692 693 expand: true, 693 cwd: BUILD_DIR,694 dest: BUILD_DIR,694 cwd: WORKING_DIR, 695 dest: WORKING_DIR, 695 696 ext: '.min.js', 696 697 src: ['wp-includes/js/wp-embed.js'] 697 698 }, … … 702 703 }, 703 704 expand: true, 704 705 cwd: 'node_modules/jquery-ui/ui/', 705 dest: BUILD_DIR + 'wp-includes/js/jquery/ui/',706 dest: WORKING_DIR + 'wp-includes/js/jquery/ui/', 706 707 ext: '.min.js', 707 708 src: ['*.js'] 708 709 }, 709 710 imgareaselect: { 710 src: BUILD_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.js',711 dest: BUILD_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.min.js'711 src: WORKING_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.js', 712 dest: WORKING_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.min.js' 712 713 }, 713 714 dynamic: { 714 715 expand: true, 715 cwd: BUILD_DIR,716 dest: BUILD_DIR,716 cwd: WORKING_DIR, 717 dest: WORKING_DIR, 717 718 ext: '.min.js', 718 719 src: [] 719 720 } 720 721 }, 721 722 webpack: { 722 prod: webpackConfig( { environment: 'production' } ), 723 devProdTarget: webpackConfig( { environment: 'development', forceBuildTarget: 'build/wp-includes' } ), 724 dev: webpackConfig( { environment: 'development' } ), 723 prod: webpackConfig( { environment: 'production', buildTarget: WORKING_DIR } ), 724 dev: webpackConfig( { environment: 'development', buildTarget: WORKING_DIR } ), 725 725 watch: webpackConfig( { environment: 'development', watch: true } ) 726 726 }, 727 727 concat: { … … 729 729 options: { 730 730 separator: '\n', 731 731 process: function( src, filepath ) { 732 return '// Source: ' + filepath.replace( BUILD_DIR, '' ) + '\n' + src;732 return '// Source: ' + filepath.replace( WORKING_DIR, '' ) + '\n' + src; 733 733 } 734 734 }, 735 735 src: [ 736 BUILD_DIR + 'wp-includes/js/tinymce/tinymce.min.js',737 BUILD_DIR + 'wp-includes/js/tinymce/themes/modern/theme.min.js',738 BUILD_DIR + 'wp-includes/js/tinymce/plugins/*/plugin.min.js'736 WORKING_DIR + 'wp-includes/js/tinymce/tinymce.min.js', 737 WORKING_DIR + 'wp-includes/js/tinymce/themes/modern/theme.min.js', 738 WORKING_DIR + 'wp-includes/js/tinymce/plugins/*/plugin.min.js' 739 739 ], 740 dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js'740 dest: WORKING_DIR + 'wp-includes/js/tinymce/wp-tinymce.js' 741 741 }, 742 742 emoji: { 743 743 options: { 744 744 separator: '\n', 745 745 process: function( src, filepath ) { 746 return '// Source: ' + filepath.replace( BUILD_DIR, '' ) + '\n' + src;746 return '// Source: ' + filepath.replace( WORKING_DIR, '' ) + '\n' + src; 747 747 } 748 748 }, 749 749 src: [ 750 BUILD_DIR + 'wp-includes/js/twemoji.min.js',751 BUILD_DIR + 'wp-includes/js/wp-emoji.min.js'750 WORKING_DIR + 'wp-includes/js/twemoji.min.js', 751 WORKING_DIR + 'wp-includes/js/wp-emoji.min.js' 752 752 ], 753 dest: BUILD_DIR + 'wp-includes/js/wp-emoji-release.min.js'753 dest: WORKING_DIR + 'wp-includes/js/wp-emoji-release.min.js' 754 754 } 755 755 }, 756 756 compress: { … … 760 760 level: 9 761 761 }, 762 762 src: '<%= concat.tinymce.dest %>', 763 dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js.gz'763 dest: WORKING_DIR + 'wp-includes/js/tinymce/wp-tinymce.js.gz' 764 764 } 765 765 }, 766 766 patch:{ … … 961 961 build: { 962 962 files: { 963 963 src: [ 964 BUILD_DIR + 'wp-{admin,includes}/**/*.js',965 BUILD_DIR + 'wp-content/themes/twenty*/**/*.js',966 '!' + BUILD_DIR + 'wp-includes/js/dist/vendor/*.js' 964 WORKING_DIR + 'wp-{admin,includes}/**/*.js', 965 WORKING_DIR + 'wp-content/themes/twenty*/**/*.js', 966 '!' + BUILD_DIR + 'wp-includes/js/dist/vendor/*.js', 967 967 ] 968 968 } 969 969 }, … … 1344 1344 1345 1345 grunt.registerTask( 'build:js', [ 1346 1346 'clean:js', 1347 'webpack:prod', 1347 1348 'webpack:dev', 1348 1349 'copy:js', 1349 1350 'file_append', … … 1353 1354 'jsvalidate:build' 1354 1355 ] ); 1355 1356 1356 grunt.registerTask( ' copy:all', [1357 'c opy:files',1357 grunt.registerTask( 'build:css', [ 1358 'clean:css', 1358 1359 'copy:wp-admin-css-compat-rtl', 1359 1360 'copy:wp-admin-css-compat-min', 1360 'copy:version',1361 'copy:js'1362 ] );1363 1364 grunt.registerTask( 'build', [1365 'clean:all',1366 'copy:all',1367 'file_append',1368 1361 'cssmin:core', 1369 1362 'colors', 1370 1363 'rtl', 1371 1364 'cssmin:rtl', 1372 1365 'cssmin:colors', 1373 'uglify:all', 1374 'build:tinymce', 1375 'concat:emoji', 1376 'includes:emoji', 1377 'includes:embed', 1378 'usebanner', 1379 'webpack:prod', 1380 'webpack:devProdTarget', 1381 'cssmin:dist', 1382 'jsvalidate:build' 1366 'usebanner' 1383 1367 ] ); 1384 1368 1369 grunt.registerTask( 'build:files', [ 1370 'clean:files', 1371 'copy:files', 1372 'copy:version', 1373 ] ); 1374 1375 grunt.registerTask( 'build', function() { 1376 if ( grunt.option( 'dev' ) ) { 1377 grunt.task.run( [ 1378 'build:js', 1379 'build:css', 1380 ] ); 1381 } else { 1382 grunt.task.run( [ 1383 'build:files', 1384 'build:js', 1385 'build:css', 1386 'includes:emoji', 1387 'includes:embed', 1388 ] ); 1389 } 1390 } ); 1391 1385 1392 grunt.registerTask( 'prerelease', [ 1386 1393 'format:php:error', 1387 1394 'precommit:php', … … 1469 1476 1470 1477 if ( minimatch.match( config.src, relative, {} ) ) { 1471 1478 dest = config.dest + relative; 1472 src = [ path.relative( BUILD_DIR, dest ) ];1479 src = [ path.relative( WORKING_DIR, dest ) ]; 1473 1480 files[ dest ] = [ filepath ]; 1474 1481 break; 1475 1482 } … … 1485 1492 // If a file in the mapping matches then set the variables for our dynamic tasks. 1486 1493 if ( dest && configs.hasOwnProperty( dest ) && configs[ dest ][0] === './' + filepath ) { 1487 1494 files[ dest ] = configs[ dest ]; 1488 src = [ path.relative( BUILD_DIR, dest ) ];1495 src = [ path.relative( WORKING_DIR, dest ) ]; 1489 1496 break; 1490 1497 } 1491 1498 } … … 1523 1530 // For javascript also minify and validate the changed file. 1524 1531 if ( target === 'js-enqueues' ) { 1525 1532 grunt.config( [ 'uglify', 'dynamic', 'src' ], src ); 1526 grunt.config( [ 'jsvalidate', 'dynamic', 'files', 'src' ], src.map( function( dir ) { return BUILD_DIR + dir; } ) );1533 grunt.config( [ 'jsvalidate', 'dynamic', 'files', 'src' ], src.map( function( dir ) { return WORKING_DIR + dir; } ) ); 1527 1534 } 1528 1535 // For webpack only validate the file, minification is handled by webpack itself. 1529 1536 if ( target === 'js-webpack' ) { 1530 grunt.config( [ 'jsvalidate', 'dynamic', 'files', 'src' ], src.map( function( dir ) { return BUILD_DIR + dir; } ) );1537 grunt.config( [ 'jsvalidate', 'dynamic', 'files', 'src' ], src.map( function( dir ) { return WORKING_DIR + dir; } ) ); 1531 1538 } 1532 1539 // For css run the rtl task on just the changed file. 1533 1540 if ( target === 'rtl' ) { -
src/index.php
11 11 define( 'ABSPATH', dirname( __FILE__ ) . '/' ); 12 12 } 13 13 14 if ( file_exists( ABSPATH . 'wp-includes/js/dist/edit-post.js' ) ) { 15 require_once ABSPATH . '/_index.php'; 16 return; 17 } 18 14 19 define( 'WPINC', 'wp-includes' ); 15 20 require_once( ABSPATH . WPINC . '/load.php' ); 16 21 -
src/wp-admin/index.php
11 11 define( 'ABSPATH', dirname( __FILE__ ) . '/../' ); 12 12 } 13 13 14 if ( file_exists( ABSPATH . 'wp-includes/js/dist/edit-post.js' ) ) { 15 require_once ABSPATH . '/_index.php'; 16 return; 17 } 18 14 19 define( 'WPINC', 'wp-includes' ); 15 20 require_once( ABSPATH . WPINC . '/load.php' ); 16 21 -
src/wp-includes/class-wp-block-parser.php
63 63 public $innerContent; 64 64 65 65 function __construct( $name, $attrs, $innerBlocks, $innerHTML, $innerContent ) { 66 $this->blockName 67 $this->attrs 68 $this->innerBlocks 69 $this->innerHTML 66 $this->blockName = $name; 67 $this->attrs = $attrs; 68 $this->innerBlocks = $innerBlocks; 69 $this->innerHTML = $innerHTML; 70 70 $this->innerContent = $innerContent; 71 71 } 72 72 } … … 269 269 */ 270 270 if ( 0 === $stack_depth ) { 271 271 if ( isset( $leading_html_start ) ) { 272 $this->output[] = (array) self::freeform( 273 substr( 274 $this->document, 275 $leading_html_start, 276 $start_offset - $leading_html_start 277 ) 278 ); 272 $this->output[] = (array) self::freeform( substr( 273 $this->document, 274 $leading_html_start, 275 $start_offset - $leading_html_start 276 ) ); 279 277 } 280 278 281 279 $this->output[] = (array) new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ); 282 $this->offset 280 $this->offset = $start_offset + $token_length; 283 281 return true; 284 282 } 285 283 … … 294 292 295 293 case 'block-opener': 296 294 // track all newly-opened blocks on the stack 297 array_push( 298 $this->stack, 299 new WP_Block_Parser_Frame( 300 new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ), 301 $start_offset, 302 $token_length, 303 $start_offset + $token_length, 304 $leading_html_start 305 ) 306 ); 295 array_push( $this->stack, new WP_Block_Parser_Frame( 296 new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ), 297 $start_offset, 298 $token_length, 299 $start_offset + $token_length, 300 $leading_html_start 301 ) ); 307 302 $this->offset = $start_offset + $token_length; 308 303 return true; 309 304 … … 334 329 * otherwise we're nested and we have to close out the current 335 330 * block and add it as a new innerBlock to the parent 336 331 */ 337 $stack_top 338 $html 339 $stack_top->block->innerHTML 332 $stack_top = array_pop( $this->stack ); 333 $html = substr( $this->document, $stack_top->prev_offset, $start_offset - $stack_top->prev_offset ); 334 $stack_top->block->innerHTML .= $html; 340 335 $stack_top->block->innerContent[] = $html; 341 $stack_top->prev_offset 336 $stack_top->prev_offset = $start_offset + $token_length; 342 337 343 338 $this->add_inner_block( 344 339 $stack_top->block, … … 396 391 return array( 'no-more-tokens', null, null, null, null ); 397 392 } 398 393 399 list( $match, $started_at ) = $matches[ 0];394 list( $match, $started_at ) = $matches[ 0 ]; 400 395 401 396 $length = strlen( $match ); 402 $is_closer = isset( $matches[ 'closer'] ) && -1 !== $matches['closer'][1];403 $is_void = isset( $matches[ 'void'] ) && -1 !== $matches['void'][1];404 $namespace = $matches[ 'namespace'];405 $namespace = ( isset( $namespace ) && -1 !== $namespace[ 1] ) ? $namespace[0] : 'core/';406 $name = $namespace . $matches[ 'name'][0];407 $has_attrs = isset( $matches[ 'attrs'] ) && -1 !== $matches['attrs'][1];397 $is_closer = isset( $matches[ 'closer' ] ) && -1 !== $matches[ 'closer' ][ 1 ]; 398 $is_void = isset( $matches[ 'void' ] ) && -1 !== $matches[ 'void' ][ 1 ]; 399 $namespace = $matches[ 'namespace' ]; 400 $namespace = ( isset( $namespace ) && -1 !== $namespace[ 1 ] ) ? $namespace[ 0 ] : 'core/'; 401 $name = $namespace . $matches[ 'name' ][ 0 ]; 402 $has_attrs = isset( $matches[ 'attrs' ] ) && -1 !== $matches[ 'attrs' ][ 1 ]; 408 403 409 404 /* 410 405 * Fun fact! It's not trivial in PHP to create "an empty associative array" since all arrays … … 411 406 * are associative arrays. If we use `array()` we get a JSON `[]` 412 407 */ 413 408 $attrs = $has_attrs 414 ? json_decode( $matches[ 'attrs'][0], /* as-associative */ true )409 ? json_decode( $matches[ 'attrs' ][ 0 ], /* as-associative */ true ) 415 410 : $this->empty_attrs; 416 411 417 412 /* … … 476 471 * @param int|null $last_offset last byte offset into document if continuing form earlier output 477 472 */ 478 473 function add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_length, $last_offset = null ) { 479 $parent 474 $parent = $this->stack[ count( $this->stack ) - 1 ]; 480 475 $parent->block->innerBlocks[] = (array) $block; 481 $html 476 $html = substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset ); 482 477 483 478 if ( ! empty( $html ) ) { 484 $parent->block->innerHTML 479 $parent->block->innerHTML .= $html; 485 480 $parent->block->innerContent[] = $html; 486 481 } 487 482 488 483 $parent->block->innerContent[] = null; 489 $parent->prev_offset 484 $parent->prev_offset = $last_offset ? $last_offset : $token_start + $token_length; 490 485 } 491 486 492 487 /** … … 505 500 : substr( $this->document, $prev_offset ); 506 501 507 502 if ( ! empty( $html ) ) { 508 $stack_top->block->innerHTML 503 $stack_top->block->innerHTML .= $html; 509 504 $stack_top->block->innerContent[] = $html; 510 505 } 511 506 512 507 if ( isset( $stack_top->leading_html_start ) ) { 513 $this->output[] = (array) self::freeform( 514 substr( 515 $this->document, 516 $stack_top->leading_html_start, 517 $stack_top->token_start - $stack_top->leading_html_start 518 ) 519 ); 508 $this->output[] = (array) self::freeform( substr( 509 $this->document, 510 $stack_top->leading_html_start, 511 $stack_top->token_start - $stack_top->leading_html_start 512 ) ); 520 513 } 521 514 522 515 $this->output[] = (array) $stack_top->block; -
tools/webpack/media.js
1 1 const UglifyJsPlugin = require( 'uglifyjs-webpack-plugin' ); 2 2 3 3 var path = require( 'path' ), 4 admin_files = {}, 5 include_files = {}; 4 admin_files = {}; 6 5 7 include_files = {8 'build/wp-includes/js/media-audiovideo.js': ['./src/js/_enqueues/wp/media/audiovideo.js'],9 'build/wp-includes/js/media-audiovideo.min.js': ['./src/js/_enqueues/wp/media/audiovideo.js'],10 'build/wp-includes/js/media-grid.js': ['./src/js/_enqueues/wp/media/grid.js'],11 'build/wp-includes/js/media-grid.min.js': ['./src/js/_enqueues/wp/media/grid.js'],12 'build/wp-includes/js/media-models.js': ['./src/js/_enqueues/wp/media/models.js'],13 'build/wp-includes/js/media-models.min.js': ['./src/js/_enqueues/wp/media/models.js'],14 'build/wp-includes/js/media-views.js': ['./src/js/_enqueues/wp/media/views.js'],15 'build/wp-includes/js/media-views.min.js': ['./src/js/_enqueues/wp/media/views.js'],16 };17 18 6 const baseDir = path.join( __dirname, '../../' ); 19 7 20 module.exports = function( env = { environment: 'production', watch: false } ) { 8 module.exports = function( env = { environment: 'production', watch: false, buildTarget: false } ) { 9 const include_files = { 10 [ env.buildTarget + 'wp-includes/js/media-audiovideo.js' ]: ['./src/js/_enqueues/wp/media/audiovideo.js'], 11 [ env.buildTarget + 'wp-includes/js/media-audiovideo.min.js' ]: ['./src/js/_enqueues/wp/media/audiovideo.js'], 12 [ env.buildTarget + 'wp-includes/js/media-grid.js' ]: ['./src/js/_enqueues/wp/media/grid.js'], 13 [ env.buildTarget + 'wp-includes/js/media-grid.min.js' ]: ['./src/js/_enqueues/wp/media/grid.js'], 14 [ env.buildTarget + 'wp-includes/js/media-models.js' ]: ['./src/js/_enqueues/wp/media/models.js'], 15 [ env.buildTarget + 'wp-includes/js/media-models.min.js' ]: ['./src/js/_enqueues/wp/media/models.js'], 16 [ env.buildTarget + 'wp-includes/js/media-views.js' ]: ['./src/js/_enqueues/wp/media/views.js'], 17 [ env.buildTarget + 'wp-includes/js/media-views.min.js' ]: ['./src/js/_enqueues/wp/media/views.js'], 18 }; 21 19 22 20 const mediaConfig = { 23 21 mode: "production", -
tools/webpack/packages.js
49 49 } ) ); 50 50 } 51 51 52 module.exports = function( env = { environment: 'production', watch: false, forceBuildTarget: false } ) {52 module.exports = function( env = { environment: 'production', watch: false, buildTarget: false } ) { 53 53 const mode = env.environment; 54 54 const suffix = mode === 'production' ? '.min' : ''; 55 const buildTarget = env.forceBuildTarget ? env.forceBuildTarget : ( mode === 'production' ? 'build' : 'src' ) + '/wp-includes'; 55 let buildTarget = env.buildTarget ? env.buildTarget : ( mode === 'production' ? 'build' : 'src' ); 56 buildTarget = buildTarget + '/wp-includes'; 56 57 57 58 const packages = [ 58 59 'api-fetch', … … 165 166 to: join( baseDir, `${ buildTarget }/css/dist/${ packageName }/` ), 166 167 flatten: true, 167 168 transform: ( content ) => { 168 if ( config.mode === 'production' && ! env.forceBuildTarget) {169 if ( config.mode === 'production' && buildTarget === 'build/' ) { 169 170 return postcss( [ 170 171 require( 'cssnano' )( { 171 172 preset: 'default', … … 268 269 config.devtool = process.env.SOURCEMAP || 'source-map'; 269 270 } 270 271 271 if ( env. forceBuildTarget) {272 if ( env.buildTarget === 'build/' ) { 272 273 delete config.devtool; 273 274 config.mode = 'production'; 274 275 config.optimization = { -
webpack.config.js
1 1 const mediaConfig = require( './tools/webpack/media' ); 2 2 const packagesConfig = require( './tools/webpack/packages' ); 3 3 4 module.exports = function( env = { environment: "production", watch: false, forceBuildTarget: false } ) {4 module.exports = function( env = { environment: "production", watch: false, buildTarget: false } ) { 5 5 if ( ! env.watch ) { 6 6 env.watch = false; 7 7 } 8 8 9 if ( ! env. forceBuildTarget ) {10 env. forceBuildTarget = false;9 if ( ! env.buildTarget ) { 10 env.buildTarget = ( env.mode === 'production' ? 'build/' : 'src/' ); 11 11 } 12 12 13 13 14 const config = [ 14 15 mediaConfig( env ), 15 16 packagesConfig( env ),