2013-08-15 18:15:49 +00:00
|
|
|
/**
|
2019-11-18 20:15:03 +00:00
|
|
|
* Special build task to handle various jQuery build requirements.
|
|
|
|
* Compiles JS modules into one bundle, sets the custom AMD name,
|
2014-07-17 17:25:59 +00:00
|
|
|
* and includes/excludes specified modules
|
2013-08-15 18:15:49 +00:00
|
|
|
*/
|
|
|
|
|
2019-10-08 22:17:55 +00:00
|
|
|
"use strict";
|
2013-08-16 13:48:00 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
const fs = require( "fs" );
|
|
|
|
const path = require( "path" );
|
|
|
|
const util = require( "util" );
|
|
|
|
const exec = util.promisify( require( "child_process" ).exec );
|
|
|
|
const rollup = require( "rollup" );
|
|
|
|
const excludedFromSlim = require( "./lib/slim-exclude" );
|
|
|
|
const rollupFileOverrides = require( "./lib/rollup-plugin-file-overrides" );
|
|
|
|
const pkg = require( "../../package.json" );
|
|
|
|
const isCleanWorkingDir = require( "./lib/isCleanWorkingDir" );
|
|
|
|
const minify = require( "./minify" );
|
|
|
|
const getTimestamp = require( "./lib/getTimestamp" );
|
|
|
|
const verifyNodeVersion = require( "./lib/verifyNodeVersion" );
|
|
|
|
const srcFolder = path.resolve( __dirname, "../../src" );
|
|
|
|
|
|
|
|
const minimum = [ "core" ];
|
|
|
|
|
|
|
|
// Exclude specified modules if the module matching the key is removed
|
|
|
|
const removeWith = {
|
|
|
|
ajax: [ "manipulation/_evalUrl", "deprecated/ajax-event-alias" ],
|
|
|
|
callbacks: [ "deferred" ],
|
|
|
|
css: [ "effects", "dimensions", "offset" ],
|
|
|
|
"css/showHide": [ "effects" ],
|
|
|
|
deferred: {
|
|
|
|
remove: [ "ajax", "effects", "queue", "core/ready" ],
|
|
|
|
include: [ "core/ready-no-deferred" ]
|
|
|
|
},
|
|
|
|
event: [ "deprecated/ajax-event-alias", "deprecated/event" ],
|
|
|
|
selector: [ "css/hiddenVisibleSelectors", "effects/animatedSelector" ]
|
|
|
|
};
|
2019-11-18 20:15:03 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
async function read( filename ) {
|
|
|
|
return fs.promises.readFile( path.join( srcFolder, filename ), "utf8" );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove the src folder and file extension
|
|
|
|
// and ensure unix-style path separators
|
|
|
|
function moduleName( filename ) {
|
|
|
|
return filename
|
|
|
|
.replace( `${srcFolder}${path.sep}`, "" )
|
|
|
|
.replace( /\.js$/, "" )
|
|
|
|
.split( path.sep )
|
|
|
|
.join( path.posix.sep );
|
|
|
|
}
|
|
|
|
|
|
|
|
async function readdirRecursive( dir, all = [] ) {
|
|
|
|
let files;
|
|
|
|
try {
|
|
|
|
files = await fs.promises.readdir( path.join( srcFolder, dir ), {
|
|
|
|
withFileTypes: true
|
|
|
|
} );
|
|
|
|
} catch ( e ) {
|
|
|
|
return all;
|
|
|
|
}
|
|
|
|
for ( const file of files ) {
|
|
|
|
const filepath = path.join( dir, file.name );
|
2019-11-18 20:15:03 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
if ( file.isDirectory() ) {
|
|
|
|
all.push( ...( await readdirRecursive( filepath ) ) );
|
|
|
|
} else {
|
|
|
|
all.push( moduleName( filepath ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return all;
|
|
|
|
}
|
2023-07-10 17:14:08 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
async function getOutputRollupOptions( { esm = false } = {} ) {
|
|
|
|
const wrapperFileName = `wrapper${esm ? "-esm" : ""}.js`;
|
|
|
|
const wrapperSource = await read( wrapperFileName );
|
2023-07-10 17:14:08 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
// Catch `// @CODE` and subsequent comment lines event if they don't start
|
|
|
|
// in the first column.
|
|
|
|
const wrapper = wrapperSource.split(
|
|
|
|
/[\x20\t]*\/\/ @CODE\n(?:[\x20\t]*\/\/[^\n]+\n)*/
|
|
|
|
);
|
2023-07-10 17:14:08 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
return {
|
2023-07-10 17:14:08 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
// The ESM format is not actually used as we strip it during the
|
|
|
|
// build, inserting our own wrappers; it's just that it doesn't
|
|
|
|
// generate any extra wrappers so there's nothing for us to remove.
|
|
|
|
format: "esm",
|
2019-11-18 20:15:03 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
intro: wrapper[ 0 ].replace( /\n*$/, "" ),
|
|
|
|
outro: wrapper[ 1 ].replace( /^\n*/, "" )
|
|
|
|
};
|
|
|
|
}
|
2019-12-02 18:55:19 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
const fileOverrides = new Map();
|
2019-12-02 18:55:19 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
function setOverride( filePath, source ) {
|
2019-12-02 18:55:19 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
// We want normalized paths in overrides as they will be matched
|
|
|
|
// against normalized paths in the file overrides Rollup plugin.
|
|
|
|
fileOverrides.set( path.resolve( filePath ), source );
|
|
|
|
}
|
2013-08-15 18:15:49 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
function unique( array ) {
|
|
|
|
return [ ...new Set( array ) ];
|
|
|
|
}
|
Build: Reduce the slim build header comment & jQuery.fn.jquery
So far, the slim build was expanded to its full exclusion list, generating the
following `jQuery.fn.jquery`:
```
v4.0.0-pre -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-callbacks,-deferred,-deferred/exceptionHook,-effects,-effects/Tween,-effects/animatedSelector,-queue,-queue/delay,-core/ready
```
This commit changes it to just `v4.0.0-pre slim`. Only the pure slim build is
treated this way, any modification to it goes through the old expansion; e.g.
for `custom:slim,-deprecated` we get the following `jQuery.fn.jquery`:
```
v4.0.0-pre -deprecated,-deprecated/ajax-event-alias,-deprecated/event,-ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-callbacks,-deferred,-deferred/exceptionHook,-effects,-effects/Tween,-effects/animatedSelector,-queue,-queue/delay,-core/ready
```
Since the version string is also put in the jQuery header comment, it also got
smaller.
Also, the logic to skip including the commit hash in the header comment - when
provided through the COMMIT environment variable which we do in Jenkins - in
minified builds headers has been applied to builds with exclusions as well.
Closes gh-4649
2020-04-27 20:23:59 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
async function checkExclude( exclude, include ) {
|
|
|
|
const included = [ ...include ];
|
|
|
|
const excluded = [ ...exclude ];
|
Build: Reduce the slim build header comment & jQuery.fn.jquery
So far, the slim build was expanded to its full exclusion list, generating the
following `jQuery.fn.jquery`:
```
v4.0.0-pre -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-callbacks,-deferred,-deferred/exceptionHook,-effects,-effects/Tween,-effects/animatedSelector,-queue,-queue/delay,-core/ready
```
This commit changes it to just `v4.0.0-pre slim`. Only the pure slim build is
treated this way, any modification to it goes through the old expansion; e.g.
for `custom:slim,-deprecated` we get the following `jQuery.fn.jquery`:
```
v4.0.0-pre -deprecated,-deprecated/ajax-event-alias,-deprecated/event,-ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-callbacks,-deferred,-deferred/exceptionHook,-effects,-effects/Tween,-effects/animatedSelector,-queue,-queue/delay,-core/ready
```
Since the version string is also put in the jQuery header comment, it also got
smaller.
Also, the logic to skip including the commit hash in the header comment - when
provided through the COMMIT environment variable which we do in Jenkins - in
minified builds headers has been applied to builds with exclusions as well.
Closes gh-4649
2020-04-27 20:23:59 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
for ( const module of exclude ) {
|
|
|
|
if ( minimum.indexOf( module ) !== -1 ) {
|
|
|
|
throw new Error( `Module \"${module}\" is a minimum requirement.` );
|
|
|
|
}
|
2013-08-15 18:15:49 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
// Exclude all files in the dir of the same name
|
|
|
|
// These are the removable dependencies
|
|
|
|
// It's fine if the directory is not there
|
|
|
|
// `selector` is a special case as we don't just remove
|
|
|
|
// the module, but we replace it with `selector-native`
|
|
|
|
// which re-uses parts of the `src/selector` dir.
|
|
|
|
if ( module !== "selector" ) {
|
|
|
|
const files = await readdirRecursive( module );
|
|
|
|
excluded.push( ...files );
|
|
|
|
}
|
2013-08-15 18:15:49 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
// Check removeWith list
|
|
|
|
const additional = removeWith[ module ];
|
|
|
|
if ( additional ) {
|
|
|
|
const [ additionalExcluded, additionalIncluded ] = await checkExclude(
|
|
|
|
additional.remove || additional,
|
|
|
|
additional.include || []
|
|
|
|
);
|
|
|
|
excluded.push( ...additionalExcluded );
|
|
|
|
included.push( ...additionalIncluded );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return [ unique( excluded ), unique( included ) ];
|
|
|
|
}
|
|
|
|
|
|
|
|
async function writeCompiled( { code, dir, filename, version } ) {
|
|
|
|
const compiledContents = code
|
|
|
|
|
|
|
|
// Embed Version
|
|
|
|
.replace( /@VERSION/g, version )
|
|
|
|
|
|
|
|
// Embed Date
|
|
|
|
// yyyy-mm-ddThh:mmZ
|
|
|
|
.replace( /@DATE/g, new Date().toISOString().replace( /:\d+\.\d+Z$/, "Z" ) );
|
|
|
|
|
|
|
|
await fs.promises.writeFile( path.join( dir, filename ), compiledContents );
|
|
|
|
console.log( `[${getTimestamp()}] ${filename} v${version} created.` );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Build jQuery ECMAScript modules
|
|
|
|
async function build( {
|
|
|
|
amd,
|
|
|
|
dir = "dist",
|
|
|
|
exclude = [],
|
|
|
|
filename = "jquery.js",
|
|
|
|
include = [],
|
|
|
|
esm = false,
|
|
|
|
slim = false,
|
|
|
|
version,
|
|
|
|
watch = false
|
|
|
|
} = {} ) {
|
|
|
|
const pureSlim = slim && !exclude.length && !include.length;
|
|
|
|
|
|
|
|
// Add the short commit hash to the version string
|
|
|
|
// when the version is not for a release.
|
|
|
|
if ( !version ) {
|
|
|
|
const { stdout } = await exec( "git rev-parse --short HEAD" );
|
|
|
|
const isClean = await isCleanWorkingDir();
|
|
|
|
|
|
|
|
// "+[slim.]SHA" is semantically correct
|
|
|
|
// Add ".dirty" as well if the working dir is not clean
|
|
|
|
version = `${pkg.version}+${slim ? "slim." : ""}${stdout.trim()}${isClean ? "" : ".dirty"}`;
|
|
|
|
} else if ( slim ) {
|
|
|
|
version += "+slim";
|
|
|
|
}
|
|
|
|
|
|
|
|
await fs.promises.mkdir( dir, { recursive: true } );
|
|
|
|
|
|
|
|
// Exclude slim modules when slim is true
|
|
|
|
const [ excluded, included ] = await checkExclude(
|
|
|
|
slim ? exclude.concat( excludedFromSlim ) : exclude,
|
|
|
|
include
|
|
|
|
);
|
|
|
|
|
|
|
|
// Replace exports/global with a noop noConflict
|
|
|
|
if ( excluded.includes( "exports/global" ) ) {
|
|
|
|
const index = excluded.indexOf( "exports/global" );
|
|
|
|
setOverride(
|
|
|
|
`${srcFolder}/exports/global.js`,
|
|
|
|
"import { jQuery } from \"../core.js\";\n\n" +
|
|
|
|
"jQuery.noConflict = function() {};"
|
|
|
|
);
|
|
|
|
excluded.splice( index, 1 );
|
|
|
|
}
|
2013-12-19 20:00:06 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
// Set a desired AMD name.
|
|
|
|
if ( amd != null ) {
|
|
|
|
if ( amd ) {
|
|
|
|
console.log( "Naming jQuery with AMD name: " + amd );
|
|
|
|
} else {
|
|
|
|
console.log( "AMD name now anonymous" );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Replace the AMD name in the AMD export
|
|
|
|
// No name means an anonymous define
|
|
|
|
const amdExportContents = await read( "exports/amd.js" );
|
|
|
|
setOverride(
|
|
|
|
`${srcFolder}/exports/amd.js`,
|
|
|
|
amdExportContents.replace(
|
2013-08-15 18:15:49 +00:00
|
|
|
|
2019-11-18 20:15:03 +00:00
|
|
|
// Remove the comma for anonymous defines
|
2023-09-18 16:39:00 +00:00
|
|
|
/(\s*)"jquery"(,\s*)/,
|
|
|
|
amd ? `$1\"${amd}\"$2` : " "
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
// Append excluded modules to version.
|
|
|
|
// Skip adding exclusions for slim builds.
|
|
|
|
// Don't worry about semver syntax for these.
|
|
|
|
if ( !pureSlim && excluded.length ) {
|
|
|
|
version += " -" + excluded.join( ",-" );
|
|
|
|
}
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
// Append extra included modules to version.
|
|
|
|
if ( !pureSlim && included.length ) {
|
|
|
|
version += " +" + included.join( ",+" );
|
|
|
|
}
|
Build: Reduce the slim build header comment & jQuery.fn.jquery
So far, the slim build was expanded to its full exclusion list, generating the
following `jQuery.fn.jquery`:
```
v4.0.0-pre -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-callbacks,-deferred,-deferred/exceptionHook,-effects,-effects/Tween,-effects/animatedSelector,-queue,-queue/delay,-core/ready
```
This commit changes it to just `v4.0.0-pre slim`. Only the pure slim build is
treated this way, any modification to it goes through the old expansion; e.g.
for `custom:slim,-deprecated` we get the following `jQuery.fn.jquery`:
```
v4.0.0-pre -deprecated,-deprecated/ajax-event-alias,-deprecated/event,-ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-callbacks,-deferred,-deferred/exceptionHook,-effects,-effects/Tween,-effects/animatedSelector,-queue,-queue/delay,-core/ready
```
Since the version string is also put in the jQuery header comment, it also got
smaller.
Also, the logic to skip including the commit hash in the header comment - when
provided through the COMMIT environment variable which we do in Jenkins - in
minified builds headers has been applied to builds with exclusions as well.
Closes gh-4649
2020-04-27 20:23:59 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
const inputOptions = {
|
|
|
|
input: `${srcFolder}/jquery.js`
|
|
|
|
};
|
Build: Reduce the slim build header comment & jQuery.fn.jquery
So far, the slim build was expanded to its full exclusion list, generating the
following `jQuery.fn.jquery`:
```
v4.0.0-pre -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-callbacks,-deferred,-deferred/exceptionHook,-effects,-effects/Tween,-effects/animatedSelector,-queue,-queue/delay,-core/ready
```
This commit changes it to just `v4.0.0-pre slim`. Only the pure slim build is
treated this way, any modification to it goes through the old expansion; e.g.
for `custom:slim,-deprecated` we get the following `jQuery.fn.jquery`:
```
v4.0.0-pre -deprecated,-deprecated/ajax-event-alias,-deprecated/event,-ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-callbacks,-deferred,-deferred/exceptionHook,-effects,-effects/Tween,-effects/animatedSelector,-queue,-queue/delay,-core/ready
```
Since the version string is also put in the jQuery header comment, it also got
smaller.
Also, the logic to skip including the commit hash in the header comment - when
provided through the COMMIT environment variable which we do in Jenkins - in
minified builds headers has been applied to builds with exclusions as well.
Closes gh-4649
2020-04-27 20:23:59 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
const includedImports = included
|
|
|
|
.map( ( module ) => `import "./${module}.js";` )
|
|
|
|
.join( "\n" );
|
2019-11-18 20:15:03 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
const jQueryFileContents = await read( "jquery.js" );
|
|
|
|
if ( include.length ) {
|
2013-08-15 18:15:49 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
// If include is specified, only add those modules.
|
|
|
|
setOverride( inputOptions.input, includedImports );
|
|
|
|
} else {
|
2019-11-18 20:15:03 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
// Remove the jQuery export from the entry file, we'll use our own
|
|
|
|
// custom wrapper.
|
|
|
|
setOverride(
|
|
|
|
inputOptions.input,
|
|
|
|
jQueryFileContents.replace( /\n*export \{ jQuery, jQuery as \$ };\n*/, "\n" ) +
|
|
|
|
includedImports
|
|
|
|
);
|
|
|
|
}
|
2019-11-18 20:15:03 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
// Replace excluded modules with empty sources.
|
|
|
|
for ( const module of excluded ) {
|
|
|
|
setOverride(
|
|
|
|
`${srcFolder}/${module}.js`,
|
2019-11-18 20:15:03 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
// The `selector` module is not removed, but replaced
|
|
|
|
// with `selector-native`.
|
|
|
|
module === "selector" ? await read( "selector-native.js" ) : ""
|
|
|
|
);
|
|
|
|
}
|
2019-11-18 20:15:03 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
const bundle = await rollup.rollup( {
|
|
|
|
...inputOptions,
|
|
|
|
plugins: [ rollupFileOverrides( fileOverrides ) ]
|
|
|
|
} );
|
2023-07-10 17:14:08 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
const outputOptions = await getOutputRollupOptions( { esm } );
|
2019-11-18 20:15:03 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
if ( watch ) {
|
|
|
|
const watcher = rollup.watch( {
|
|
|
|
...inputOptions,
|
|
|
|
output: [ outputOptions ],
|
|
|
|
plugins: [ rollupFileOverrides( fileOverrides ) ],
|
|
|
|
watch: {
|
|
|
|
include: `${srcFolder}/**`,
|
|
|
|
skipWrite: true
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
|
|
|
watcher.on( "event", async( event ) => {
|
|
|
|
switch ( event.code ) {
|
|
|
|
case "ERROR":
|
|
|
|
console.error( event.error );
|
|
|
|
break;
|
|
|
|
case "BUNDLE_END":
|
|
|
|
const {
|
|
|
|
output: [ { code } ]
|
|
|
|
} = await event.result.generate( outputOptions );
|
|
|
|
|
|
|
|
await writeCompiled( {
|
|
|
|
code,
|
|
|
|
dir,
|
|
|
|
filename,
|
|
|
|
version
|
|
|
|
} );
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
await minify( { dir, filename, esm } );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} );
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
return watcher;
|
|
|
|
} else {
|
|
|
|
const {
|
|
|
|
output: [ { code } ]
|
|
|
|
} = await bundle.generate( outputOptions );
|
2013-09-09 02:26:05 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
await writeCompiled( { code, dir, filename, version } );
|
|
|
|
await minify( { dir, filename, esm } );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async function buildDefaultFiles( { version, watch } = {} ) {
|
|
|
|
await Promise.all( [
|
|
|
|
build( { version, watch } ),
|
|
|
|
build( { filename: "jquery.slim.js", slim: true, version, watch } ),
|
|
|
|
build( {
|
|
|
|
dir: "dist-module",
|
|
|
|
filename: "jquery.module.js",
|
|
|
|
esm: true,
|
|
|
|
version,
|
|
|
|
watch
|
|
|
|
} ),
|
|
|
|
build( {
|
|
|
|
dir: "dist-module",
|
|
|
|
filename: "jquery.slim.module.js",
|
|
|
|
esm: true,
|
|
|
|
slim: true,
|
|
|
|
version,
|
|
|
|
watch
|
|
|
|
} )
|
|
|
|
] );
|
|
|
|
|
|
|
|
// Earlier Node.js versions do not support the ESM format.
|
|
|
|
if ( !verifyNodeVersion() ) {
|
|
|
|
return;
|
|
|
|
}
|
2013-08-15 18:15:49 +00:00
|
|
|
|
2023-09-18 16:39:00 +00:00
|
|
|
const { compareSize } = await import( "./compare_size.mjs" );
|
|
|
|
return compareSize( {
|
|
|
|
files: [
|
|
|
|
"dist/jquery.min.js",
|
|
|
|
"dist/jquery.slim.min.js",
|
|
|
|
"dist-module/jquery.module.min.js",
|
|
|
|
"dist-module/jquery.slim.module.min.js"
|
|
|
|
]
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2023-09-18 16:39:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = { build, buildDefaultFiles };
|