@@ -61,7 +61,7 @@ gulp.task('babel', () =>
6161/**
6262 ES6 to babel AMD modules
6363*/
64- gulp . task ( 'babel-amd' , ( ) =>
64+ gulp . task ( 'babel-amd-core ' , ( ) =>
6565 gulp . src ( paths . src )
6666 . pipe ( replace ( '__TLDS__' , tldsReplaceStr ) )
6767 . pipe ( babel ( {
@@ -72,10 +72,29 @@ gulp.task('babel-amd', () =>
7272 moduleIds : true
7373 // moduleRoot: 'linkifyjs'
7474 } ) )
75+ . pipe ( quickEs3 ( ) )
7576 . pipe ( gulp . dest ( 'build/amd' ) ) // Required for building plugins separately
76- . pipe ( amdOptimize ( 'linkify' ) )
77- . pipe ( concat ( 'linkify.amd.js' ) )
77+ ) ;
78+
79+
80+ /**
81+ ES6 to babel AMD modules
82+ Must run interfaces first because a more optimized core linkify payload will
83+ overwrite the AMD-generated one
84+ */
85+ gulp . task ( 'babel-amd' , [ 'babel-amd-core' ] , ( ) =>
86+ gulp . src ( paths . srcCore )
87+ . pipe ( rollup ( {
88+ bundle : {
89+ format : 'amd' ,
90+ moduleId : 'linkify' ,
91+ moduleName : 'linkify'
92+ }
93+ } ) )
94+ . pipe ( babel ( ) )
95+ . pipe ( replace ( '__TLDS__' , tldsReplaceStr ) )
7896 . pipe ( quickEs3 ( ) )
97+ . pipe ( concat ( 'linkify.amd.js' ) )
7998 . pipe ( gulp . dest ( 'build' ) )
8099) ;
81100
@@ -232,6 +251,7 @@ gulp.task('build-polyfill', () =>
232251// Build steps
233252gulp . task ( 'build' , [
234253 'babel' ,
254+ 'babel-amd-core' ,
235255 'babel-amd' ,
236256 'build-core' ,
237257 'build-interfaces' ,
@@ -340,16 +360,8 @@ gulp.task('karma-amd-ci', (callback) => {
340360 return server . start ( ) ;
341361} ) ;
342362
343- // Build the deprecated legacy interface
344- gulp . task ( 'build-legacy' , [ 'build' ] , ( ) =>
345- gulp . src ( [ 'build/linkify.js' , 'build/linkify-jquery.js' ] )
346- . pipe ( concat ( 'jquery.linkify.js' ) )
347- . pipe ( wrap ( { src : 'templates/linkify-legacy.js' } ) )
348- . pipe ( gulp . dest ( 'build/dist' ) )
349- ) ;
350-
351363// Build a file that can be used for easy headless benchmarking
352- gulp . task ( 'build-benchmark' , [ 'build-legacy ' ] , ( ) =>
364+ gulp . task ( 'build-benchmark' , [ 'build' ] , ( ) =>
353365 gulp . src ( 'build/dist/jquery.linkify.js' )
354366 . pipe ( concat ( 'linkify-benchmark.js' ) )
355367 . pipe ( wrap ( { src : 'templates/linkify-benchmark.js' } ) )
@@ -358,26 +370,18 @@ gulp.task('build-benchmark', ['build-legacy'], () =>
358370) ;
359371
360372// NOTE: DO NOT Upgrade gulp-uglify, it breaks IE8 and the options don't seem to be working
361- gulp . task ( 'uglify' , [ 'build-legacy ' ] , ( ) => {
373+ gulp . task ( 'uglify' , [ 'build' ] , ( ) => {
362374 let options = {
363375 mangleProperties : {
364376 regex : new RegExp ( `^(?!(${ unmangleableProps . join ( '|' ) } )).*$` )
365377 }
366378 } ;
367379
368- let task = gulp . src ( 'build/*.js' )
380+ return gulp . src ( 'build/*.js' )
369381 . pipe ( gulp . dest ( 'dist' ) ) // non-minified copy
370382 . pipe ( rename ( ( path ) => path . extname = '.min.js' ) )
371383 . pipe ( uglify ( options ) )
372384 . pipe ( gulp . dest ( 'dist' ) ) ;
373-
374- let taskLegacy = gulp . src ( 'build/dist/jquery.linkify.js' )
375- . pipe ( gulp . dest ( 'dist/dist' ) ) // non-minified copy
376- . pipe ( rename ( ( path ) => path . extname = '.min.js' ) )
377- . pipe ( uglify ( options ) )
378- . pipe ( gulp . dest ( 'dist/dist' ) ) ;
379-
380- return merge ( task , taskLegacy ) ;
381385} ) ;
382386
383387gulp . task ( 'dist' , [ 'uglify' ] ) ;
0 commit comments