aboutsummaryrefslogtreecommitdiffstats
path: root/build
Commit message (Collapse)AuthorAgeFilesLines
* Tests: migrate testing infrastructure to minimal dependenciesTimmy Willison2024-02-263-65/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a complete rework of our testing infrastructure. The main goal is to modernize and drop deprecated or undermaintained dependencies (specifically, grunt, karma, and testswarm). We've achieved that by limiting our dependency list to ones that are unlikely to drop support any time soon. The new dependency list includes: - `qunit` (our trusty unit testing library) - `selenium-webdriver` (for spinning up local browsers) - `express` (for starting a test server and adding middleware) - express middleware includes uses of `body-parser` and `raw-body` - `yargs` (for constructing a CLI with pretty help text) - BrowserStack (for running each of our QUnit modules separately in all of our supported browsers) - `browserstack-local` (for opening a local tunnel. This is the same package still currently used in the new Browserstack SDK) - We are not using any other BrowserStack library. The newest BrowserStack SDK does not fit our needs (and isn't open source). Existing libraries, such as `node-browserstack` or `browserstack-runner`, either do not quite fit our needs, are under-maintained and out-of-date, or are not robust enough to meet all of our requirements. We instead call the [BrowserStack REST API](https://github.com/browserstack/api) directly. ## BrowserStack Runner - automatically retries individual modules in case of test failure(s) - automatically attempts to re-establish broken tunnels - automatically refreshes the page in case a test run has stalled - runs all browsers concurrently and uses as many sessions as are available under the BrowserStack plan. It will wait for available sessions if there are none. - supports filtering the available list of browsers by browser name, browser version, device, OS, and OS version (see `npm run test:unit -- --list-browsers` for more info). It will retrieve the latest matching browser available if any of those parameters are not specified. - cleans up after itself (closes the local tunnel, stops the test server, etc.) - Requires `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` environment variables. ## Selenium Runner - supports running any local browser as long as the driver is installed, including support for headless mode in Chrome, FF, and Edge - supports running `basic` tests on the latest [jsdom](https://github.com/jsdom/jsdom#readme), which can be seen in action in this PR (see `test:browserless`) - Node tests will run as before in PRs and all non-dependabot branches, but now includes tests on real Safari in a GH actions macos image instead of playwright-webkit. - can run multiple browsers and multiple modules concurrently Other notes: - Stale dependencies have been removed and all remaining dependencies have been upgraded with a few exceptions: - `sinon`: stopped supporting IE in version 10. But, `sinon` has been updated to 9.x. - `husky`: latest does not support Node 10 and runs on `npm install`. Needed for now until git builds are migrated to GitHub Actions. - `rollup`: latest does not support Node 10. Needed for now until git builds are migrated to GitHub Actions. - BrowserStack tests are set to run on each `main` branch commit - `debug` mode leaves Selenium browsers open whether they pass or fail and leaves browsers with test failures open on BrowserStack. The latter is to avoid leaving open too many sessions. - This PR includes a workflow to dispatch BrowserStack runs on-demand - The Node version used for most workflow tests has been upgraded to 20.x - updated supportjQuery to 3.7.1 Run `npm run test:unit -- --help` for CLI documentation Close gh-5418
* Release: add factory files to release distributionTimmy Willison2024-02-081-1/+5
| | | | Fixes gh-5411 Close gh-5412
* Release: use buildDefaultFiles directly and pass versionTimmy Willison2024-02-064-5/+10
| | | | | | | | - 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
* Release: copy dist-module folder as wellTimmy Willison2024-02-051-7/+18
| | | Close gh-5407
* Release: only published versioned files to cdnTimmy Willison2024-02-051-0/+3
| | | Close gh-5406
* Release: remove scripts and dev deps from dist package.jsonTimmy Willison2024-02-051-2/+14
| | | | | | - this became necessary due to the addition of the prepare script - scripts aren't needed and don't work in the dist repo Close gh-5404
* Release: update build command in Release.generateArtifactsTimmy Willison2024-01-311-1/+1
| | | Close gh-5399
* Build: migrate grunt authors to a custom scriptTimmy Willison2024-01-221-0/+105
| | | | | | | - the new script pulls all authors from the Sizzle repo - added temporary grunt task for releases Close gh-5395
* Build: Update ESLint-related packages, fix linting errorsMichał Gołębiowski-Owczarek2023-11-026-23/+27
| | | | | | | | 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
* Docs: Fix module links in the package READMEMichał Gołębiowski-Owczarek2023-09-221-6/+6
| | | | | | | The package README used to show examples importing from a regular jQuery file; this won't work natively. Instead, use module versions of jQuery in these examples. Closes gh-5336
* Build: sort branches in compare_size; last run lastTimmy Willison2023-09-211-3/+20
| | | Close gh-5333
* 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
* Build: add commit SHAs and last runs to comparisonsTimmy Willison2023-09-201-20/+66
| | | | | | | - only remove the short SHA and .dirty from version strings - automatically reset the cache on version mismatch Close gh-5329
* Core: Add more info about named exportsMichał Gołębiowski-Owczarek2023-09-201-5/+23
| | | | | | Also, fix an example importing from `jquery/src/css.js` as that is supposed to use named exports now. Closes gh-5328
* Core: Move the factory to separate exportsMichał Gołębiowski-Owczarek2023-09-195-46/+179
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1816-544/+777
| | | | | | | | | | | | | | | | | | | | | | | | | 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: replace CRLF with LF during minifyTimmy Willison2023-08-101-1/+2
| | | | | | - SWC is not respecting the git setting and does not have an option to force LF. This fixes the build on Windows. Close gh-5305
* Build: Add `exports` to package.json, export slim & esm buildsMichał Gołębiowski-Owczarek2023-07-109-188/+360
| | | | | | | | | | | | | | | | | | | | 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-103-2/+58
| | | | | | | | 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-273-48/+1
| | | | | | | | | | 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-312-2/+2
| | | | | | | | | | | | | | | 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
* Release: add support for md5 sums in windowsTimmy Willison2023-03-091-2/+15
| | | Close gh-5219
* 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
* Docs: Update the README of the published packageMichał Gołębiowski-Owczarek2022-10-031-5/+3
| | | | | | | | The previous details were showing their age, e.g. mentions about browsers not supporting ES2015. The story with ES modules is more complex as it's also about loaders but to keep the README simple, let's just make it more up to date with typical usage. Closes gh-5108
* Docs: Update webpack website in READMESimon Legner2022-07-121-1/+1
| | | | | Webpack has migrated to https://webpack.js.org/ since version 2. Closes gh-5037
* Tests: Exclude tests based on compilation flags, not API presenceMichał Gołębiowski-Owczarek2022-06-282-2/+12
| | | | | | | | | | 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
* Release: remove the need to install grunt globallyTimmy Willison2021-03-011-3/+3
|
* Release: upgrade release dependenciesTimmy Willison2021-03-011-4/+3
| | | | - Remove unused npm dependency
* Build: Rename master to main across the repositoryMichał Gołębiowski-Owczarek2021-02-051-4/+4
| | | | | | The default branch was updated, this updates the remaining occurrences in code & comments. Closes gh-4838
* 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
* Release: Remove an unused chalk dependencyMichał Gołębiowski-Owczarek2020-05-181-2/+1
| | | | | Chalk was used for a Sizzle version check that's no longer there on `master`. Closes gh-4712
* Build: Update eslint-config-jquery, fix linting violationsMichał Gołębiowski-Owczarek2020-05-181-1/+1
| | | | | Closes gh-4696 Ref jquery/eslint-config-jquery#15 Ref jquery/eslint-config-jquery#16
* Build: Followups after introducing ES modules compiled via RollupMichał Gołębiowski-Owczarek2020-05-052-3/+4
| | | | | | | | | | 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
* Docs: Fix typosPierre Grimaud2020-04-291-1/+1
| | | Closes gh-4686
* 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
* Docs: Update the link to the jsdom repositoryMichał Gołębiowski-Owczarek2020-04-251-1/+1
| | | Closes gh-4684
* Docs: Use https for hyperlinks in READMEJonathan2020-04-171-4/+4
| | | Closes gh-4673
* Release: Use an in-repository dist README fixtureMichał Gołębiowski-Owczarek2020-03-023-63/+132
| | | | | | | | | | Use a dist README fixture kept in the jQuery repository instead of modifying an existing one. This makes the jQuery repository the single source of truth when it comes to jQuery releases and it makes it easier to make changes to README without worrying how it will affect older jQuery lines. The commit also ES6ifies build/release.js & build/release/dist.js Closes gh-4614
* 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:Tests: Fix custom build tests, verify on Travis Michał Gołębiowski-Owczarek2020-01-071-1/+1
| | | | | | | | | | | 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: Create a `grunt custom:slim` alias for the Slim build (#4578)Michał Gołębiowski-Owczarek2020-01-072-2/+20
| | | Closes gh-4578
* Build: Auto-convert sources to AMDMichał Gołębiowski-Owczarek2019-12-093-5/+54
| | | | | | | | | | | | | | | 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
* Build: Fix the Windows buildMichał Gołębiowski-Owczarek2019-12-022-17/+51
| | | | | | | 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-099-12/+18
| | | | | | | | 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: Support jquery-release --dry-run flagMichał Gołębiowski-Owczarek2019-10-051-1/+2
| | | | | | | Without this change passing `--dry-run` to jquery-release still pushes to the jquery-dist repository which is dangerous as one can assume `--dry-run` to be safe from external side effects. Close gh-4498
* Build: Stop copying src/core.js to dist on releaseMichał Gołębiowski-Owczarek2019-10-041-4/+7
| | | | | | | | File `src/core.js` has started erroneously being copied to `dist/` in gh-2981. Fixes gh-4489 Closes gh-4492 Ref gh-2979 Ref gh-2981
* Selector: Inline Sizzle into the selector moduleMichał Gołębiowski-Owczarek2019-07-294-85/+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