Make WordPress Core

Changeset 44740


Ignore:
Timestamp:
02/14/2019 12:06:39 AM (6 years ago)
Author:
peterwilsoncc
Message:

Build: Remove source map from jquery.form.min.js.

Minimize jquery.form.js as part of build process to remove the source map reference.

Modify source map tests to include all JavaScript files rather than testing Backbone and jQuery only.

Props pento.
Fixes #46218.

Location:
trunk
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Gruntfile.js

    r44651 r44740  
    172172                        [ WORKING_DIR + 'wp-includes/js/jquery/jquery-migrate.min.js' ]: [ './node_modules/jquery-migrate/dist/jquery-migrate.min.js' ],
    173173                        [ WORKING_DIR + 'wp-includes/js/jquery/jquery.form.js' ]: [ './node_modules/jquery-form/src/jquery.form.js' ],
    174                         [ WORKING_DIR + 'wp-includes/js/jquery/jquery.form.min.js' ]: [ './node_modules/jquery-form/dist/jquery.form.min.js' ],
    175174                        [ WORKING_DIR + 'wp-includes/js/jquery/jquery.js' ]: [ './node_modules/jquery/dist/jquery.min.js' ],
    176175                        [ WORKING_DIR + 'wp-includes/js/masonry.min.js' ]: [ './node_modules/masonry-layout/dist/masonry.pkgd.min.js' ],
     
    720719                src: WORKING_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.js',
    721720                dest: WORKING_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.min.js'
     721            },
     722            jqueryform: {
     723                src: WORKING_DIR + 'wp-includes/js/jquery/jquery.form.js',
     724                dest: WORKING_DIR + 'wp-includes/js/jquery/jquery.form.min.js'
    722725            },
    723726            dynamic: {
     
    11941197        'jshint:corejs',
    11951198        'uglify:imgareaselect',
     1199        'uglify:jqueryform',
    11961200        'qunit:compiled'
    11971201    ] );
     
    13331337        'uglify:embed',
    13341338        'uglify:jqueryui',
    1335         'uglify:imgareaselect'
     1339        'uglify:imgareaselect',
     1340        'uglify:jqueryform'
    13361341    ] );
    13371342
  • trunk/tests/phpunit/tests/dependencies/jquery.php

    r42343 r44740  
    8484
    8585    /**
    86      * @ticket 24994
    87      */
    88     function test_exclusion_of_sourcemaps() {
    89         $contents = trim( file_get_contents( ABSPATH . WPINC . '/js/jquery/jquery.js' ) );
    90         $this->assertFalse( strpos( $contents, 'sourceMappingURL' ), 'Presence of sourceMappingURL' );
    91     }
    92 
    93     /**
    9486     * @ticket 28404
    9587     */
  • trunk/tests/phpunit/tests/dependencies/scripts.php

    r44403 r44740  
    13421342        );
    13431343    }
     1344
     1345    function test_no_source_mapping() {
     1346        $all_files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( dirname( ABSPATH ) . '/build/' ) );
     1347        $js_files  = new RegexIterator( $all_files, '/\.js$/' );
     1348        foreach( $js_files as $js_file ) {
     1349            $contents = trim( file_get_contents( $js_file ) );
     1350
     1351            // We allow data: URLs.
     1352            $found = preg_match( '/sourceMappingURL=((?!data:).)/', $contents );
     1353            $this->assertSame( $found, 0, "sourceMappingURL found in $js_file" );
     1354        }
     1355    }
    13441356}
Note: See TracChangeset for help on using the changeset viewer.