Make WordPress Core

Changeset 51268


Ignore:
Timestamp:
06/30/2021 02:13:30 AM (5 years ago)
Author:
desrosj
Message:

Build/Test Tools: Revert [51259-51256,51265].

[51259] introduced a PHP notice that was not actually fixed by [51265]. Reverting these changes in order to investigate further.

See #53397.

Location:
trunk
Files:
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/.gitignore

    r51259 r51268  
    3030/src/wp-includes/css/*-rtl.css
    3131/src/wp-includes/blocks/**/*.css
    32 /src/wp-includes/blocks/**/*.js
    33 /src/wp-includes/blocks/**/*.js.map
    34 /src/wp-includes/blocks/**/*.asset.php
    3532/packagehash.txt
    3633/artifacts
  • trunk/Gruntfile.js

    r51259 r51268  
    997997                                                WORKING_DIR + 'wp-content/themes/twenty*/**/*.js',
    998998                                                '!' + WORKING_DIR + 'wp-content/themes/twenty*/node_modules/**/*.js',
    999                                                 '!' + WORKING_DIR + 'wp-includes/blocks/**/*.js',
    1000999                                                '!' + WORKING_DIR + 'wp-includes/js/dist/**/*.js',
    10011000                                        ]
  • trunk/src/wp-includes/blocks.php

    r51267 r51268  
    4343                        $asset_handle .= '-editor';
    4444                }
    45                 if ( 0 === strpos( $field_name, 'view' ) ) {
    46                         $asset_handle .= '-view';
    47                 }
    4845                return $asset_handle;
    4946        }
    … …  
    5249                'editorScript' => 'editor-script',
    5350                'script'       => 'script',
    54                 'viewScript'   => 'view-script',
    5551                'editorStyle'  => 'editor-style',
    5652                'style'        => 'style',
    … …  
    106102                return false;
    107103        }
    108         $is_core_block       = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], ABSPATH . WPINC );
    109         $script_uri          = $is_core_block ?
    110                 includes_url( str_replace( ABSPATH . WPINC, '', realpath( dirname( $metadata['file'] ) . '/' . $script_path ) ) ) :
    111                 plugins_url( $script_path, $metadata['file'] );
    112         $script_asset        = require $script_asset_path;
    113         $script_dependencies = isset( $script_asset['dependencies'] ) ? $script_asset['dependencies'] : array();
    114         $result              = wp_register_script(
     104        $script_asset = require $script_asset_path;
     105        $result       = wp_register_script(
    115106                $script_handle,
    116                 $script_uri,
    117                 $script_dependencies,
    118                 isset( $script_asset['version'] ) ? $script_asset['version'] : false
     107                plugins_url( $script_path, $metadata['file'] ),
     108                $script_asset['dependencies'],
     109                $script_asset['version']
    119110        );
    120111        if ( ! $result ) {
    … …  
    122113        }
    123114
    124         if ( ! empty( $metadata['textdomain'] ) && in_array( 'wp-i18n', $script_dependencies ) ) {
     115        if ( ! empty( $metadata['textdomain'] ) ) {
    125116                wp_set_script_translations( $script_handle, $metadata['textdomain'] );
    126117        }
    … …  
    321312        }
    322313
    323         if ( ! empty( $metadata['viewScript'] ) ) {
    324                 $settings['view_script'] = register_block_script_handle(
    325                         $metadata,
    326                         'viewScript'
    327                 );
    328         }
    329 
    330314        if ( ! empty( $metadata['editorStyle'] ) ) {
    331315                $settings['editor_style'] = register_block_style_handle(
  • trunk/src/wp-includes/blocks/file

    • Property svn:ignore
      •  

        old new  
        11*.css
        2 *.asset.php
        3 *.js
        4 *.js.map
  • trunk/src/wp-includes/class-wp-block-type.php

    r51260 r51268  
    157157
    158158        /**
    159          * Block type editor only script handle.
     159         * Block type editor script handle.
    160160         *
    161161         * @since 5.0.0
    … …  
    165165
    166166        /**
    167          * Block type front end and editor script handle.
     167         * Block type front end script handle.
    168168         *
    169169         * @since 5.0.0
    … …  
    173173
    174174        /**
    175          * Block type front end only script handle.
    176          *
    177          * @since 5.8.0
    178          * @var string|null
    179          */
    180         public $view_script = null;
    181 
    182         /**
    183          * Block type editor only style handle.
     175         * Block type editor style handle.
    184176         *
    185177         * @since 5.0.0
    … …  
    189181
    190182        /**
    191          * Block type front end and editor style handle.
     183         * Block type front end style handle.
    192184         *
    193185         * @since 5.0.0
    … …  
    234226         *     @type array         $uses_context     Context values inherited by blocks of this type.
    235227         *     @type array|null    $provides_context Context provided by blocks of this type.
    236          *     @type string|null   $editor_script    Block type editor only script handle.
    237          *     @type string|null   $script           Block type front end and editor script handle.
    238          *     @type string|null   $view_script      Block type front end only script handle.
    239          *     @type string|null   $editor_style     Block type editor only style handle.
    240          *     @type string|null   $style            Block type front end and editor style handle.
     228         *     @type string|null   $editor_script    Block type editor script handle.
     229         *     @type string|null   $script           Block type front end script handle.
     230         *     @type string|null   $editor_style     Block type editor style handle.
     231         *     @type string|null   $style            Block type front end style handle.
    241232         * }
    242233         */
  • trunk/tests/phpunit/data/blocks/notice/block.json

    r51259 r51268  
    4949        "editorScript": "tests-notice-editor-script",
    5050        "script": "tests-notice-script",
    51         "viewScript": "tests-notice-view-script",
    5251        "editorStyle": "tests-notice-editor-style",
    5352        "style": "tests-notice-style"
  • trunk/tests/phpunit/tests/blocks/register.php

    r51259 r51268  
    134134                );
    135135                $this->assertSame(
    136                         'unit-tests-my-block-view-script',
    137                         generate_block_asset_handle( $block_name, 'viewScript' )
    138                 );
    139                 $this->assertSame(
    140136                        'unit-tests-my-block-editor-style',
    141137                        generate_block_asset_handle( $block_name, 'editorStyle' )
    … …  
    160156                        'wp-block-paragraph',
    161157                        generate_block_asset_handle( $block_name, 'script' )
    162                 );
    163                 $this->assertSame(
    164                         'wp-block-paragraph-view',
    165                         generate_block_asset_handle( $block_name, 'viewScript' )
    166158                );
    167159                $this->assertSame(
    … …  
    381373                $this->assertSame( 'tests-notice-editor-script', $result->editor_script );
    382374                $this->assertSame( 'tests-notice-script', $result->script );
    383                 $this->assertSame( 'tests-notice-view-script', $result->view_script );
    384375                $this->assertSame( 'tests-notice-editor-style', $result->editor_style );
    385376                $this->assertSame( 'tests-notice-style', $result->style );
  • trunk/tools/webpack/packages.js

    r51259 r51268  
    107107        };
    108108
     109        const dynamicBlockFolders = [
     110                'archives',
     111                'block',
     112                'calendar',
     113                'categories',
     114                'file',
     115                'latest-comments',
     116                'latest-posts',
     117                'loginout',
     118                'page-list',
     119                'post-content',
     120                'post-date',
     121                'post-excerpt',
     122                'post-featured-image',
     123                'post-terms',
     124                'post-title',
     125                'post-template',
     126                'query',
     127                'query-pagination',
     128                'query-pagination-next',
     129                'query-pagination-numbers',
     130                'query-pagination-previous',
     131                'query-title',
     132                'rss',
     133                'search',
     134                'shortcode',
     135                'site-logo',
     136                'site-tagline',
     137                'site-title',
     138                'social-link',
     139                'tag-cloud',
     140        ];
     141        const blockFolders = [
     142                'audio',
     143                'button',
     144                'buttons',
     145                'code',
     146                'column',
     147                'columns',
     148                'cover',
     149                'embed',
     150                'freeform',
     151                'gallery',
     152                'group',
     153                'heading',
     154                'html',
     155                'image',
     156                'list',
     157                'media-text',
     158                'missing',
     159                'more',
     160                'nextpage',
     161                'paragraph',
     162                'preformatted',
     163                'pullquote',
     164                'quote',
     165                'separator',
     166                'social-links',
     167                'spacer',
     168                'table',
     169                'text-columns',
     170                'verse',
     171                'video',
     172                ...dynamicBlockFolders,
     173        ];
    109174        const phpFiles = {
    110175                'block-serialization-default-parser/parser.php': 'wp-includes/class-wp-block-parser.php',
     176                'widgets/src/blocks/legacy-widget/index.php': 'wp-includes/blocks/legacy-widget.php',
     177                ...dynamicBlockFolders.reduce( ( files, blockName ) => {
     178                        files[ `block-library/src/${ blockName }/index.php` ] = `wp-includes/blocks/${ blockName }.php`;
     179                        return files;
     180                } , {} ),
     181        };
     182        const blockMetadataFiles = {
     183                'widgets/src/blocks/legacy-widget/block.json': 'wp-includes/blocks/legacy-widget/block.json',
     184                ...blockFolders.reduce( ( files, blockName ) => {
     185                        files[ `block-library/src/${ blockName }/block.json` ] = `wp-includes/blocks/${ blockName }/block.json`;
     186                        return files;
     187                } , {} ),
    111188        };
    112189
    … …  
    153230                from: join( baseDir, `node_modules/@wordpress/${ filename }` ),
    154231                to: join( baseDir, `src/${ phpFiles[ filename ] }` ),
     232        } ) );
     233
     234        const blockMetadataCopies = Object.keys( blockMetadataFiles ).map( ( filename ) => ( {
     235                from: join( baseDir, `node_modules/@wordpress/${ filename }` ),
     236                to: join( baseDir, `src/${ blockMetadataFiles[ filename ] }` ),
     237        } ) );
     238
     239        const blockStylesheetCopies = blockFolders.map( ( blockName ) => ( {
     240                from: join( baseDir, `node_modules/@wordpress/block-library/build-style/${ blockName }/*.css` ),
     241                to: join( baseDir, `${ buildTarget }/blocks/${ blockName }/` ),
     242                flatten: true,
     243                transform: ( content ) => {
     244                        if ( mode === 'production' ) {
     245                                return postcss( [
     246                                        require( 'cssnano' )( {
     247                                                preset: 'default',
     248                                        } ),
     249                                ] )
     250                                        .process( content, { from: 'src/app.css', to: 'dest/app.css' } )
     251                                        .then( ( result ) => result.css );
     252                        }
     253
     254                        return content;
     255                },
     256                transformPath: ( targetPath, sourcePath ) => {
     257                        if ( mode === 'production' ) {
     258                                return targetPath.replace( /\.css$/, '.min.css' );
     259                        }
     260
     261                        return targetPath;
     262                }
    155263        } ) );
    156264
    … …  
    245353                                        ...cssCopies,
    246354                                        ...phpCopies,
     355                                        ...blockMetadataCopies,
     356                                        ...blockStylesheetCopies,
    247357                                ],
    248358                        ),
  • trunk/webpack.config.js

    r51259 r51268  
    1 const blocksConfig = require( './tools/webpack/blocks' );
    21const mediaConfig = require( './tools/webpack/media' );
    32const packagesConfig = require( './tools/webpack/packages' );
    … …  
    1312
    1413        const config = [
    15                 blocksConfig( env ),
    1614                mediaConfig( env ),
    1715                packagesConfig( env ),
Note: See TracChangeset for help on using the changeset viewer.