aboutsummaryrefslogtreecommitdiffstats
path: root/Gruntfile.js
Commit message (Collapse)AuthorAgeFilesLines
* Build: Add `exports` to package.json, export slim & esm buildsMichał Gołębiowski-Owczarek2023-07-101-439/+0
| | | | | | | | | | | | | | | | | | | | 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
* CSS: Make the reliableTrDimensions support test work with Bootstrap CSSMichał Gołębiowski-Owczarek2023-07-101-0/+4
| | | | | | | | | | | | | | | | | | | Bootstrap 5 includes the following CSS on the page: ```css *, *::before, *::after { box-sizing: border-box; } ``` That threw our `reliableTrDimensions` support test off. This change fixes the support test and adds a unit test ensuring support test values on a page including Bootstrap 5 CSS are the same as on a page without it. Fixes gh-5270 Closes gh-5278 Ref gh-5279
* Build: Switch form Terser to SWC for JS minification (#5286)Michał Gołębiowski-Owczarek2023-07-101-15/+29
| | | | | | | | 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: Drop individual AMD modulesMichał Gołębiowski-Owczarek2023-06-271-22/+0
| | | | | | | | | | With this change, jQuery build no longer generates the `amd` directory with AMD modules transpiled from source `src` ECMAScript Modules. To use individual jQuery modules from source, ESM is now required. Note that this DOES NOT affect the main `"jquery"` AMD module defined by built jQuery files; those remain supported. Closes gh-5276
* Build: Switch the minifier from UglifyJS to TerserMichał Gołębiowski-Owczarek2023-05-311-13/+14
| | | | | | | | | | | | | | | 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: Make the `eslint:dev` task not lint the `dist/` folderMichał Gołębiowski-Owczarek2023-05-311-1/+5
| | | | | | | There was a mistake in paths logic that made the `dist/` folder linted even in the `eslint:dev` task which is run before the build. Fix that by explicitly ignoring the `dist/` folder at the end of the file list. Closes gh-5257
* Build: Run GitHub Action browser tests on Playwright WebKitMichał Gołębiowski-Owczarek2023-01-231-15/+20
| | | | | | | | | | | | | | | | | | | | | | | | So far, we've been running browser tests on GitHub Actions in Chrome and Firefox. Regular Safari is not available in GitHub Actions but Playwright WebKit comes close to a dev version of Safari. With this change, our GitHub CI & local test runs will invoke tests on all actively developed browser engines on all PRs. Also, our GitHub Actions browser tests are now running on Node.js 18. Detection of the Playwright WebKit browser in support unit tests is done by checking if the `test_browser` query parameter is set to `"Playwright"`; this is a `karma-webkit-launcher` feature. Detecting that browser via user agent as we normally do is hard as the UA on Linux is very similar to a real Safari one but it actually uses a newer version of the engine. In addition, we now allow to pass custom browsers when one needs it; e.g., to run the tests in all three engines on Linux/macOS, run: ``` grunt && BROWSERS=ChromeHeadless,FirefoxHeadless,WebkitHeadless grunt karma:main ``` Closes gh-5190
* Selector: Re-introduce selector-native.jsMichał Gołębiowski-Owczarek2022-11-211-3/+3
| | | | | | | | | | | | | | | | | | | | | 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
* Build: Test on Node 17, update Grunt & `karma-*` packagesMichał Gołębiowski-Owczarek2022-03-141-3/+12
| | | | | | | | | | | | | | This adds testing on Node.js 17 in addition to the currently tested 10, 12, 14 and 16 versions. Also, update Grunt & `karma-*` packages. Testing in Karma on jsdom is broken in Node 17 at the moment; until we find a fix, this change disables such testing on Node 17 or newer. Node smoke tests & promises aplus tests are disabled on Node.js 10 as they depend on jsdom and the latest jsdom version doesn't run properly on Node 10. Closes gh-5023
* Build: remove travis.yml and travis mentions from core (#4983)Timmy Willison2021-12-131-1/+1
| | | | We've migrated to GH actions on jQuery core and have already disabled travis builds for core.
* Build: Migrate CI to GitHub Actionsygj62021-11-301-5/+5
| | | Closes gh-4800
* Tests: Make Karma browser timeout larger than the QUnit oneMichał Gołębiowski-Owczarek2021-10-301-0/+4
| | | | | | | | | Since the default Karma browser no activity timeout was lower than the QUnit timeout, a single timing out test was interrupting the whole test run of a browser. The QUnit timeout is set to 1 minute so I set the Karma one to 2 minutes. Closes gh-4943
* Build: Update ESLint & eslint-plugin-import, fixing the buildMichał Gołębiowski-Owczarek2021-10-291-13/+32
| | | | | | | | | | Latest `main` started failing the build after some transitive dependencies got updated, incorrectly recognizing some files with default exports as unused. Since the new ESLint no longer supports Node 10 which we have to build on due to use in our CI, skip ESLint in Node 10. Ref gh-3225 Closes gh-4961
* Build: Take core-js-bundle from the external directory as wellMichał Gołębiowski-Owczarek2021-04-131-0/+3
| | | | | | | That package was missed in gh-4865 as it only broke browsers needing the polyfill which is just IE at the moment. Thus, it broke Core tests in IE only. Ref gh-4865 Closes gh-4870
* Build: Restore the external directoryMichał Gołębiowski-Owczarek2021-03-241-4/+24
| | | | | | | | | | | | In gh-4466, we removed the `external` directory in favor of loading some files directly from `node_modules`. This works fine locally but when deploying code for tests, this makes it impossible to not deploy `node_modules` as well. To avoid the issue, this change restores usage of the `external` directory. One change is that we no longer commit this directory to the repository, its only purpose is to have clear isolation from `node_modules`. Ref gh-4466 Closess gh-4865
* Build: Append .eslintignore paths to grunt eslint pathsEd Sanders2020-07-271-5/+15
| | | | | | | This allows us to turn off the `quiet` option which was suppressing warnings. We can also set `maxWarnings` to 0 now that aren't any. Closes gh-4689
* Docs: Change JS Foundation mentions to OpenJS FoundationMichał Gołębiowski-Owczarek2020-05-181-1/+1
| | | Closes gh-4711
* 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: Lint the minified jQuery file as well - a Gruntfile fixMichał Gołębiowski-Owczarek2020-01-271-1/+1
| | | | | | | | While we have absolutely no style-related expectations to our minified file, we do care that it's valid ES 5.1. This is now verified. Fixes gh-3075 Ref gh-4594 Closes gh-4598
* Ajax: Deprecate AJAX event aliases, inline event/alias into deprecatedMichał Gołębiowski-Owczarek2020-01-211-2/+3
| | | | | | | | A new `src/deprecated` directory makes it possible to exclude some deprecated APIs from a custom build when their respective "parent" module is excluded without keeping that module outside of the `src/deprecated` directory or the `src/deprecated.js` file. Closes gh-4572
* Build: Make dev mode work in Karma again, serve source files from diskMichał Gołębiowski-Owczarek2020-01-081-4/+21
| | | | | | | | | | | | | | | | | | PR gh-4550 added support for running ES modules & AMD tests via Karma. This required reading the `esmodules` & `amd` props from both `QUnit.config` & `QUnit.urlParams`. By picking these two properties manually, the `dev` one stopped being respected while ones handled directly by QUnit were fine (like `hidepassed`). Instead of maintaining the full list of options, the code now iterates over QUnit URL config and handles the fallbacks in a more generic way. Apart from that, all jQuery source & test files are now read directly from disk instead of being cached by Karma so that one can run `grunt karma:chrome-debug` & work on a fix without restarting that Karma run after each change. A similar effect could have been achieved by setting `autoWatch` to `true` but then the main Karma page runs tests in an iframe by default when `grunt karma:chrome-debug` is run instead of relying on the current debug flow. Closes gh-4574 Ref gh-4550
* Build:Tests: Fix custom build tests, verify on Travis Michał Gołębiowski-Owczarek2020-01-071-2/+8
| | | | | | | | | | | This commit fixes unit tests for the following builds: 1. The no-deprecated build: `custom:-deprecated` 2. The current slim build: `custom:-ajax,-effects` 3. The future (#4553) slim build: `custom:-ajax,-callbacks,-deferred,-effects` It also adds separate Travis jobs for the no-deprecated & slim builds. Closes gh-4577
* Build: Make Karma work in ES modules modeMichał Gołębiowski-Owczarek2019-12-161-27/+39
| | | | | | Also, run such a suite in CI to make sure modules are working as expected when used directly. Closes gh-4550
* Build: Auto-convert sources to AMDMichał Gołębiowski-Owczarek2019-12-091-0/+2
| | | | | | | | | | | | | | | jQuery source has been migrated in gh-4541 from AMD to ES modules. To maintain support for consumers of our AMD modules, this commits adds a task transpiling the ES modules sources in `src/` to AMD in `amd/`. A "Load with AMD" checkbox was also restored to the QUnit setup. Note that, contrary to jQuery 3.x, AMD files need to be generated via `grunt amd` or `grunt` as sources are not authored in ECMAScript modules. To achieve a similar no-compile experience during jQuery 4.x testing, use the new "Load as modules" checkbox which works in all supported browsers except for IE & Edge (the legacy, EdgeHTML-based one). Ref gh-4541 Closes gh-4554
* Core: Migrate from AMD to ES modules 🎉Michał Gołębiowski-Owczarek2019-11-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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: Run tests on Travis only on browsers defined in the configMichał Gołębiowski-Owczarek2019-10-221-2/+4
| | | | | | The environmental variable BROWSERS was being created but it wasn't read in the list of browsers to pass to Karma. Closes gh-4532
* Build: Run tests on Travis on FirefoxHeadless as wellMichał Gołębiowski-Owczarek2019-10-211-5/+2
| | | | | | | | | | Also, run them on both ChromeHeadless & FirefoxHeadless locally on `grunt karma:main`. Plus, so far, the chrome addons were installed for all the jobs, even the ones that weren't used for browser testing. Changing that makes those jobs faster. Closes gh-4524
* Build: Require strict mode in Node.js scripts via ESLintMichał Gołębiowski-Owczarek2019-10-091-2/+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
* Build: Remove the external directory, read from node_modules directlyMichał Gołębiowski-Owczarek2019-08-261-24/+4
| | | | | | Now that Sizzle is gone & we use npm, we can read from node_modules directly and skip the setup that copies some files to the external directory. Closes gh-4466
* Tests: update npo.js and include unminified source insteadTimmy Willison2019-08-121-1/+1
| | | | Close gh-4446 Ref gh-4445
* Selector: Inline Sizzle into the selector moduleMichał Gołębiowski-Owczarek2019-07-291-5/+1
| | | | | | | | | | | | | | | | | | 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
* Core: Drop support for IE <11, iOS <11, Firefox <65, Android Browser & PhantomJSMichał Gołębiowski-Owczarek2019-04-291-36/+7
| | | | | | | | | | | Also, update support comments format to match format described in: https://github.com/jquery/contribute.jquery.org/issues/95#issuecomment-69379197 with the change from: https://github.com/jquery/contribute.jquery.org/issues/95#issuecomment-448998379 (open-ended ranges end with `+`). Fixes gh-3950 Fixes gh-4299 Closes gh-4347
* Build: Run the basic test suite in jsdomMichał Gołębiowski-Owczarek2019-03-111-2/+50
| | | | | | The basic test suite is now run in jsdom on all supported Node.js versions (8, 10 & 11 as of now). Closes gh-4310
* Build: Update QUnit from 1.23.1 to 2.9.2Michał Gołębiowski-Owczarek2019-03-041-9/+3
| | | Closes gh-4307
* Build: Update jsdom; migrate a test with Symbol polyfill to an iframe testMichał Gołębiowski-Owczarek2019-03-041-2/+2
| | | | | | | | | | | So far, we've been testing that jQuery element iteration works with polyfilled Symbol & transpiled for-of via a Node test with jsdom with the Symbol global removed. Unfortunately, jsdom now requires Symbol to be present for its internal functionality so such a test is no longer possible. Instead, it's been migrated to an iframe test with transpiled JavaScript. This PR also enables us to use ECMAScript 2017 or newer in Node.js code. Closes gh-4305
* Build: Update most dependenciesabnud12019-02-191-1/+1
| | | | | | | | | | | | | | | | The only packages not fully updated are: - qunitjs & karma-qunit as that's a QUnit 2.x update that will require some changes and we'll do that later - jsdom as we need to first rewrite the test with the Symbol polyfill - newer jsdom versions don't work with such a hacked Symbol instance - sinon as the v2 -> v7 upgrade requires to update our unit tests - uglify-js & grunt-contrib-uglify as latest uglify-js versions slightly worsen the minified gzipped size Closes gh-4227 Closes gh-4228 Closes gh-4230 Closes gh-4232
* Tests: add IE launcher for debugging IE11 on WindowsTimmy Willison2018-11-271-0/+4
|
* Tests: Allow Karma to load unminfied sourceRichard Gibson2018-09-071-4/+4
| | | Closes gh-4128
* Traversing: $.fn.contents() support for objectLuis Emilio Velasco Sanchez2018-05-141-1/+1
| | | | | Fixes gh-4045 Closes gh-4046
* Build: Don't require sudo on Travis, use sandboxless headless ChromeMichał Gołębiowski-Owczarek2018-03-191-2/+11
| | | | | | The Chrome sandbox doesn't work on Travis unless sudo is enabled. Instead, we're disabling the Chrome sandbox. Closes gh-4011
* Build: remove artefact from previous commitOleg Gaydarenko2018-03-071-1/+0
| | | | Follow-up for 09684ba3f210594e41ecddf369ac94c688d53ccb
* Build: Seasonal update of uglify and its optionsOleg Gaydarenko2018-03-051-1/+1
| | | | | | | | raw gz Compared to last run = = dist/jquery.js -294 -88 dist/jquery.min.js Closes gh-3994
* Build: Add "-debug" suffix to name of karma debug tasksTimo Tijhof2018-01-171-12/+15
| | | | | Ref gh-3922 Close gh-3936
* Tests: correctly set sudo in travis config, not karma configTimmy Willison2018-01-161-7/+1
|
* Tests: temporarily require sudo access for karma:main on travisTimmy Willison2018-01-161-1/+7
| | | | | - This should fix the broken travis build on Node 8 - See https://github.com/travis-ci/travis-ci/issues/8836
* Build: Fix UglifyJS output in Android 4.0; update uglifyTimmy Willison2018-01-081-1/+6
| | | | | | | - Thanks to @mgol for first pass Fixes gh-3743 Close gh-3920
* Tests: Add support for running unit tests via grunt with karmaTimo Tijhof2017-12-181-0/+84
| | | | | | | | | | | | | - Update QUnit to 1.23.1 - Remove unused dl#dl from test/index.html - Remove unused map#imgmap from test/index.html - Ensure all urls to data use baseURI - Add the 'grunt karma:main' task - customContextFile & customDebugFile - Add 'npm run jenkins' script Close gh-3744 Fixes gh-1999
* Build: Update to Babel 7, use for-of plugin instead of preset-es2015Henry Zhu2017-09-251-1/+2
| | | Closes gh-3786
* Build: fix uglify options for uglify updateTimmy Willison2017-07-101-3/+7
| | | | | | | - Uses new typeofs option for compression - See https://github.com/mishoo/UglifyJS2/issues/2198 Close gh-3710
* Build: Drop support for building on Node.js 0.12Michał Gołębiowski2016-12-301-28/+11
| | | | | | | | | | | Node.js 0.12 is no longer supported by upstream. So far we had to keep a workaround that would skip running ESLint there (or even load its task) as it no longer supports Node.js <4; the same applied to Node smoke tests as jsdom has also dropped support for those old Node versions. Those workarounds have been removed now. Ref 030191ae32dfcb7ecb2efb61d17a4964a3633e44 Closes gh-3478