aboutsummaryrefslogtreecommitdiffstats
path: root/build/tasks/build.js
Commit message (Collapse)AuthorAgeFilesLines
* Release: correct build date in verification; other improvementsTimmy Willison2024-07-291-1/+4
| | | | | | | | | | | | | | | | | | | | - the date is actually the date of the commit *prior* to the tag commit, as the files are built and then committed. - also, the CDN should still be checked for non-stable releases, and should use different filenames (including in the map files). - certain files should be skipped when checking the CDN. - removed file diffing because it ended up being far too noisy, making it difficult to find the info I needed. - because the build script required an addition, release verification will not work until the next release. - print all files in failure case and whether each matched - avoid npm script log in GH release notes changelog - exclude changelog.md from release:clean command - separate the post-release script from release-it for now, so we can keep manual verification before each push. The exact command is printed at the ened for convenience. Closes gh-5521
* Release: migrate release process to release-itTimmy Willison2024-07-111-42/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *Authors* - Checking and updating authors has been migrated to a custom script in the repo *Changelog* - changelogplease is no longer maintained - generate changelog in markdown for GitHub releases - generate changelog in HTML for blog posts - generate contributors list in HTML for blog posts *dist* - clone dist repo, copy files, and commit/push - commit tag with dist files on main branch; remove dist files from main branch after release *cdn* - clone cdn repo, copy files, and commit/push - create versioned and unversioned copies in cdn/ - generate md5 sums and archives for Google and MSFT *build* - implement reproducible builds and verify release builds * uses the last modified date for the latest commit * See https://reproducible-builds.org/ - the verify workflow also ensures all files were properly published to the CDN and npm *docs* - the new release workflow is documented at build/release/README.md *misc* - now that we don't need the jquery-release script and now that we no longer need to build on Node 10, we can use ESM in all files in the build folder - move dist wrappers to "wrappers" folders for easy removal of all built files - limit certain workflows to the main repo (not forks) - version in package.json has been set to beta.1 so that the next release will be beta.2 - release-it added the `preReleaseBase` option and we now always set it to `1` in the npm script. This is a noop for stable releases. Fixes jquery/jquery-release#114 Closes gh-5512
* Build: drop support for Node 10Timmy Willison2024-03-091-9/+9
| | | | Close gh-5436
* Release: use buildDefaultFiles directly and pass versionTimmy Willison2024-02-061-1/+4
| | | | | | | | - also add the ability to pass VERSION in env to test final builds - adjust sha regex to account for lack of shas - set the version on the dist package.json Close gh-5408
* Build: Update ESLint-related packages, fix linting errorsMichał Gołębiowski-Owczarek2023-11-021-11/+13
| | | | | | | | The main change is the new rule in `eslint-config-jquery`: `template-curly-spacing`. Closes gh-5347 Ref jquery/eslint-config-jquery#21 Ref gh-5348
* Build: fix inconsistent builds in Node 20Timmy Willison2023-09-201-14/+14
| | | | | | | - one fileOverrides per build - only run the lint build when running lint Close gh-5332
* Core: Move the factory to separate exportsMichał Gołębiowski-Owczarek2023-09-191-5/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since versions 1.11.0/2.1.0, jQuery has used a module wrapper with one strange addition - in CommonJS environments, if a global `window` with a `document` was not present, jQuery exported a factory accepting a `window` implementation and returning jQuery. This approach created a number of problems: 1. Properly typing jQuery would be a nightmare as the exported value depends on the environment. In practice, typing definitions ignored the factory case. 2. Since we now use named exports for the jQuery module version, it felt weird to have `jQuery` and `$` pointing to the factory instead of real jQuery. Instead, for jQuery 4.0 we leverage the just added `exports` field in `package.json` to expose completely separate factory entry points: one for the full build, one for the slim one. Exports definitions for `./factory` & `./factory-slim` are simpler than for `.` and `./slim` - this is because it's a new entry point, we only expose a named export and so there's no issue with just pointing Node.js to the CommonJS version (we cannot use the module version for `import` from Node.js to avoid double package hazard). The factory entry points are also not meant for the Web browser which always has a proper `window` - and they'd be unfit for an inclusion in a regular script tag anyway. Because of that, we also don't generate minified versions of these entry points. The factory files are not pushed to the CDN since they are mostly aimed at Node.js. Closes gh-5293
* Build: migrate most grunt tasks off of gruntTimmy Willison2023-09-181-312/+318
| | | | | | | | | | | | | | | | | | | | | | | | | Updated tasks include: - lint - npmcopy - build, minify, and process for distribution. - new custom build command using yargs - compare size of minified/gzip built files - pretest scripts, including qunit-fixture, babel transpilation, and npmcopy - node smoke tests - promises aplus tests - new watch task using `rollup.watch` directly Also: - upgraded husky and added the new lint command - updated lint config to use new "flat" config format. See https://eslint.org/docs/latest/use/configure/configuration-files-new - Temporarily disabled one lint rule until flat config is supported by eslint-plugin-import. See https://github.com/import-js/eslint-plugin-import/issues/2556 - committed package-lock.json - updated all test scripts to use the new build - added an express test server that uses middleware-mockserver (this can be used to run tests without karma) - build-all-variants is now build:all Close gh-5318
* Core: Use named exports in `src/`Michał Gołębiowski-Owczarek2023-09-121-1/+1
| | | | | | | | | The `default` export is treated differently across tooling when transpiled to CommonJS - tools differ on whether `module.exports` represents the full module object or just its default export. Switch `src/` modules to named exports for tooling consistency. Fixes gh-5262 Closes gh-5292
* Build: Add `exports` to package.json, export slim & esm buildsMichał Gołębiowski-Owczarek2023-07-101-16/+27
| | | | | | | | | | | | | | | | | | | | Summary of the changes: * define the `exports` field in `package.json`; `jQuery` & `$` are also exported as named exports in ESM builds now * declare `"type": "module"` globally except for the `build` folder * add the `--esm` option to `grunt custom`, generating jQuery as an ECMAScript module into the `dist-module` folder * expand `node_smoke_tests` to test the slim & ESM builds and their various combinations; also, test both jQuery loaded via a path to the file as well as from module specifiers that should be parsed via the `exports` feature * add details about ESM usage to the release package README * run `compare_size` on all built minified files; don't run it anymore on unminified files where they don't provide lots of value * remove the remove_map_comment task; SWC doesn't insert the `//# sourceMappingURL=` pragma by default so there's nothing to strip Fixes gh-4592 Closes gh-5255
* Build: Switch form Terser to SWC for JS minification (#5286)Michał Gołębiowski-Owczarek2023-07-101-1/+1
| | | | | | | | Also, as part of this, fix the `file` & `sources` properties of the source map file. Fixes gh-5285 Closes gh-5286 Ref gh-5258
* Build: Switch the minifier from UglifyJS to TerserMichał Gołębiowski-Owczarek2023-05-311-1/+1
| | | | | | | | | | | | | | | UglifyJS is ES5-only, while Terser supports newer ECMAScript versions. jQuery is authored in ES5 but jQuery 4.x will also have an ESM build that cannot be minified using UglifyJS directly. We could strip the `export` statement, minify via UglifyJS and re-add one but that increases complexity & may not fully play nice with source maps. On the other hand, switching to Terser increases the minfied size by just 324 bytes and the minified gzipped one by just 70 bytes. Such differences largely disappear among bigger size gains from the `3.x-stable` line - around 2.7 KB minified gzipped as of now. Closes gh-5258
* Build: remove stale Insight package from custom buildsTimmy Willison2022-12-201-41/+1
| | | Close gh-5182
* Selector: Re-introduce selector-native.jsMichał Gołębiowski-Owczarek2022-11-211-9/+21
| | | | | | | | | | | | | | | | | | | | | Re-introduce the `selector-native` similar to the one on the `3.x-stable` branch. One difference is since the `main` branch inlined Sizzle, some selector utils can be shared between the main `selector` module and `selector-native`. The main `selector` module can be disabled in favor of `selector-native` via: grunt custom:-selector Other changes: * Tests: Fix Safari detection - Chrome Headless has a different user agent than Safari and a browser check in selector tests didn't take that into account. * Tests: Run selector-native tests in `npm test` * Selector: Fix querying on document fragments Ref gh-4395 Closes gh-5085
* Tests: Exclude tests based on compilation flags, not API presenceMichał Gołębiowski-Owczarek2022-06-281-2/+2
| | | | | | | | | | Introduces a new test API, `includesModule`. The method returns whether a particular module like "ajax" or "deprecated" is included in the current jQuery build; it handles the slim build as well. The util was created so that we don't treat presence of particular APIs to decide whether to run a test as then if we accidentally remove an API, the tests would still not fail. Fixes gh-5069 Closes gh-5046
* Build: Explicitly exclude the queue module from the slim buildMichał Gołębiowski-Owczarek2020-09-281-1/+1
| | | | | | | | | | The queue module is not present in the slim build as it depends on deferred and our Gruntfile specifies excluding deferred should also exclude queue: https://github.com/jquery/jquery/blob/3.5.1/Gruntfile.js#L66 This commit makes this exclusion explicit so that the queue module never accidentally gets re-included in the slim build if it stopped importing from the deferred module directly. Closes gh-4793
* Build: Followups after introducing ES modules compiled via RollupMichał Gołębiowski-Owczarek2020-05-051-2/+2
| | | | | | | | | | This commit cleans up a few comments & configurations that are out of date after the migration to ES modules backed by a Rollup-based compilation. Also, de-indent AMD modules. This will preserve a more similar structure to the one on 3.x-stable where the body of the main `define` wrapper is not indented. Closes gh-4705
* Build: Reduce the slim build header comment & jQuery.fn.jqueryMichał Gołębiowski-Owczarek2020-04-271-21/+36
| | | | | | | | | | | | | | | | | | | | | | | 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
* Core: Exclude callbacks & deferred modules in the slim build as wellMichał Gołębiowski-Owczarek2020-01-201-1/+1
| | | | | | | | | | | So far, the slim build only excluded ajax & effects modules. As many web apps right now rely on native Promises, often with a polyfill for legacy browsers, deferred & callbacks modules are not that useful for sites that already exclude ajax & effects modules. This decreases the gzipped minified size of the slim module by 1760 bytes, to 19706 bytes (below 20k!). Closes gh-4553
* Build: Create a `grunt custom:slim` alias for the Slim build (#4578)Michał Gołębiowski-Owczarek2020-01-071-1/+19
| | | Closes gh-4578
* Build: Fix the Windows buildMichał Gołębiowski-Owczarek2019-12-021-17/+27
| | | | | | | This commit gets rid of rollup-plugin-hypothetical in favor of a simpler inline Rollup plugin that fits our need and is compatible with Windows. Fixes gh-4548 Closes gh-4549
* Core: Migrate from AMD to ES modules 🎉Michał Gołębiowski-Owczarek2019-11-181-207/+174
| | | | | | | | | | | | | | | | | | | | | | Migrate all source AMD modules to ECMAScript modules. The final bundle is compiled by a custom build process that uses Rollup under the hood. Test files themselves are still loaded via RequireJS as that has to work in IE 11. Tests can now be run in "Load as modules" mode which replaces the previous "Load with AMD" option. That option of running tests doesn't work in IE and Edge as it requires support for dynamic imports. Some of the changes required by the migration: * check `typeof` of `noGlobal` instead of using the variable directly as it's not available when modules are used * change the nonce module to be an object as ECMASscript module exports are immutable * remove some unused exports * import `./core/parseHTML.js` directly in `jquery.js` so that it's not being cut out when the `ajax` module is excluded in a custom compilation Closes gh-4541
* Build: Require strict mode in Node.js scripts via ESLintMichał Gołębiowski-Owczarek2019-10-091-3/+2
| | | | | | | | So far, only browser-based JS files were required to be in strict mode (in the function form). This commit adds such a requirement to Node.js scripts where the global form is preferred. All Node.js scripts in sloppy mode were converted to strict mode. Closes gh-4499
* Selector: Inline Sizzle into the selector moduleMichał Gołębiowski-Owczarek2019-07-291-19/+0
| | | | | | | | | | | | | | | | | | This commit removes Sizzle from jQuery, inlining its code & removing obsolete workarounds where applicable. The selector-native module has been removed. Further work on the selector module may decrease the size enough that it will no longer be necessary. If it turns out it's still useful, we'll reinstate it but the code will look different anyway as we'll want to share as much code as possible with the existing selector module. The Sizzle AUTHORS.txt file has been merged with the jQuery one - people are sorted by their first contributions to either of the two repositories. The commit reduces the gzipped jQuery size by 1460 bytes compared to master. Closes gh-4395
* Build: ESLint: forbid unused function parametersMichał Gołębiowski-Owczarek2019-05-131-1/+1
| | | | | | | | | | | | | This commit requires all function parameters to be used, not just the last one. In cases where that's not possible as we need to match an external API, there's an escape hatch of prefixing an unused argument with `_`. This change makes it easier to catch unused AMD dependencies and unused parameters in internal functions the API of which we may change at will, among other things. Unused AMD dependencies have been removed as part of this commit. Closes gh-4381
* Build: Fix the regex parsing AMD var-modules (#4389)Michał Gołębiowski-Owczarek2019-05-131-1/+1
| | | | | | | | | | | | | | | | The previous regex caused the final jQuery binary to have syntax errors for var-modules with names starting with "return". For example, the following module wouldn't work when the file is named `returnTrue.js`: ```js define( function() { "use strict"; return function returnTrue() { return true; }; } ); ``` Closes gh-4389
* Build: Make the @CODE-replacing regex more robustMichał Gołębiowski2016-12-051-1/+5
| | | | | | | | | | | | | The code replacing @CODE in wrapper.js was written so that it expected both the code and the next line to start in the first column. This commit adjusts the regex so to get rid of that assumption and to work properly regardless of number of lines with comments after this block. While this is technically not necessary for our code, contributors sometimes re-format the wrapper file in their pull requests and the error messages they get don't tell them what's the real problem with their code. Closes gh-3429
* Core: expose noConflict in AMD modeTimmy Willison2016-08-151-5/+1
| | | | | | | | - For compability reasons, we had already added the global in AMD mode, but without noConflict. This adds back noConflict to AMD (which fixes noConflict mode in the tests). Fixes gh-2930
* Build: Fix the regex removing the ESLint comment from wrapper.jsMichał Gołębiowski2016-07-131-1/+1
| | | | | | | The new regex from after the switch from JSHint to ESLint wasn't catching the ESLint pragma correctly. Also, the spacing of the pragma comment was updated to match other comments.
* Build: ESLint detailsOleg Gaidarenko2016-06-111-2/+9
| | | | | | Use eslint pragmas, fix new errors, etc Closes gh-3148
* Build: Strip the strict-mode related comment in exports/global.jsMichał Gołębiowski2016-04-261-1/+4
| | | | | | | The comment (& the JSHint pragma) doesn't make sense in the context of the full built file. Closes gh-3078
* Build: Strip excessive "use strict" pragmas when buildingMichał Gołębiowski2016-04-261-1/+1
| | | | Fixes gh-3077
* Deferred: Remove default callback contextRichard Gibson2016-04-231-0/+3
| | | | | | | Employs strict mode to simplify Deferred callback context handling. Fixes gh-3060 Closes gh-3061
* Core: implement ready without DeferredTimmy Willison2016-04-041-2/+11
| | | | | | | | | - Make jQuery.ready promise-compatible - Gives up sync guarantee for post-ready callbacks Fixes gh-1778 Fixes gh-1823 Close gh-2891
* Build: try insight package to get info about custom buildsOleg Gaidarenko2016-03-141-2/+41
| | | | | Fixes gh-2890 Closes gh-2988
* Build: combine intro and outroTimmy Willison2016-03-091-2/+7
| | | | | Fixes gh-2975 Close gh-2976
* Build: use hard-coded path to sizzle in selector-sizzleTimmy Willison2016-02-101-4/+1
| | | | Fixes gh-2898
* Release: push a custom slim build to the CDNTimmy Willison2015-11-161-2/+6
| | | | | Fixes gh-2653 Close gh-2711
* Build: Fixed issue with base path that contain 'var'Martin Naumann2015-10-121-1/+1
| | | | | | | Remove the cwd from the paths, so the regex doesn't kick in on "var" Fixes gh-2450 Closes gh-2641
* Build: Update jscs and lint filesOleg Gaidarenko2015-09-071-15/+36
| | | | Fixes gh-2056
* Build: space between curly and paren is optionalTimmy Willison2015-06-191-2/+2
| | | | | Fixes gh-2399 Close gh-2400
* Build: fix tests in AMD modeTimmy Willison2014-12-091-8/+5
|
* Build: Remove empty define({}) from build outputDavid Corbacho2014-12-041-1/+3
| | | | | Fixes gh-1768 Closes gh-1569
* Build: Fix various typosOleg Gaidarenko2014-11-081-1/+1
| | | | | | | Thanks @jamesgpearce, @vlajos, @imyousuf Closes gh-1828 Closes gh-1830 Closes gh-1844
* Build: update grunt-jscs-checker and pass with the new rulesTimmy Willison2014-07-171-11/+25
|
* Build: Move all external libraries to external directoryScott González2014-06-241-1/+1
| | | | Closes gh-1593
* Build: Fix AMD option for custom buildsTimmy Willison2014-03-071-6/+12
| | | | Fixes #14859
* Build: add build option for setting the AMD name.Timmy Willison2013-12-191-2/+9
| | | | Fixes #14016.
* Build: Add the ability to remove global exposure.Timmy Willison2013-12-191-0/+7
| | | | Ref #14016
* Manage bower dependencies with grunt-bowercopyTimmy Willison2013-12-061-1/+1
| | | | | | | | | | | | Tracked bower dependencies are located at "src/sizzle" and "test/libs". The source-destination mapping is in the Gruntfile. When updating a bower dependency, update the version in bower.json, run `grunt bower`, and then commit the result. When adding a dependency, update the bowercopy task accordingly. Fixes #14615. Closes gh-1452.