Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
webpack: Do not use expose-loader for jQuery.
Anders Kaseorg85a2ba869347
diff --git a/docs/subsystems/html-css.md b/docs/subsystems/html-css.mdindex 9e6868e906f..aa512fcd6be 100644--- a/docs/subsystems/html-css.md+++ b/docs/subsystems/html-css.md@@ -289,8 +289,8 @@ webpack plugin (`web/debug-require-webpack-plugin.ts`) that exposesa version of the `require()` function to the development environmentbrowser console for this purpose. For example, you can access our`people` module by evaluating-`people = require("./src/people")`, or the third-party `lodash`-module with `_ = require("lodash")`. This mechanism is **not** a+`let people = require("./src/people")`, or the third-party `lodash`+module with `let _ = require("lodash")`. This mechanism is **not** astable API and should not be used for any purpose other thaninteractive debugging.diff --git a/package.json b/package.jsonindex 8b64814b491..6bb891a22f4 100644--- a/package.json+++ b/package.json@@ -179,6 +179,7 @@},"patchedDependencies": {"handlebars": "patches/handlebars.patch",+ "jquery-caret-plugin": "patches/jquery-caret-plugin.patch","simplebar": "patches/simplebar.patch","stylelint-high-performance-animation": "patches/stylelint-high-performance-animation.patch","svgicons2svgfont": "patches/svgicons2svgfont.patch",diff --git a/patches/jquery-caret-plugin.patch b/patches/jquery-caret-plugin.patchnew file mode 100644index 00000000000..fd73f777c3c--- /dev/null+++ b/patches/jquery-caret-plugin.patch@@ -0,0 +1,22 @@+diff --git a/.npmignore b/.npmignore+deleted file mode 100644+index 4da4dff4991ffc88e38185209e5ff8134d9f5044..0000000000000000000000000000000000000000+diff --git a/dist/jquery.caret.js b/dist/jquery.caret.js+index c29f02925df743d698e32266f20c47bf6a41e02a..9ca25d23b0276f80ebaf982766eb9a6ea393abbf 100644+--- a/dist/jquery.caret.js++++ b/dist/jquery.caret.js+@@ -1,6 +1,8 @@+ /*! jQuery Caret Plugin - v1.5.2 - 2014-03-25+ * https://github.com/acdvorak/jquery.caret+ * Copyright (c) 2012-2014 Andrew C. Dvorak; Licensed MIT */++import jQuery from "jquery";+++ (function($, undefined) {++ var _input = document.createElement('input');+@@ -540,4 +542,4 @@+ }+ });++-}(window.jQuery || window.Zepto || window.$));++}(jQuery));diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex e92a15bec5e..cee0d2b2eef 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -15,6 +15,9 @@ patchedDependencies:handlebars:hash: 53ad8d748fa2ca3a7a0502c46f2ed1236eef8162efec84c06849dc83ad9e28e9path: patches/handlebars.patch+ jquery-caret-plugin:+ hash: 1afee996e4f991b021b9432ad558cacb8d078cdd828444dbd39836726b3ba6ad+ path: patches/jquery-caret-plugin.patchsimplebar:hash: b02691a06d37a4991c993e8b03c1860e01f2edef7c18ad0b958d9b222ba9be9bpath: patches/simplebar.patch@@ -181,7 +184,7 @@ importers:version: 3.7.1jquery-caret-plugin:specifier: ^1.5.2- version: 1.5.3+ version: 1.5.3(patch_hash=1afee996e4f991b021b9432ad558cacb8d078cdd828444dbd39836726b3ba6ad)jquery-validation:specifier: ^1.19.0version: 1.21.0([email protected])@@ -16329,7 +16332,7 @@ snapshots:- [email protected]: {}+ [email protected](patch_hash=1afee996e4f991b021b9432ad558cacb8d078cdd828444dbd39836726b3ba6ad): {}dependencies:diff --git a/version.py b/version.pyindex 0e68fa470d8..dcab533bc2f 100644--- a/version.py+++ b/version.py@@ -50,4 +50,4 @@ API_FEATURE_LEVEL = 459# historical commits sharing the same major version, in which case a# minor version bump suffices.-PROVISION_VERSION = (367, 0) # bumped 2026-01-30 to patch autosize+PROVISION_VERSION = (367, 1) # bumped 2026-02-02 to patch jquery-caret-plugindiff --git a/web/third/jquery-idle/jquery.idle.js b/web/third/jquery-idle/jquery.idle.jsindex 62fda8c6749..ea5b1084a1f 100644--- a/web/third/jquery-idle/jquery.idle.js+++ b/web/third/jquery-idle/jquery.idle.js@@ -43,6 +43,8 @@* - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.**/+import jQuery from "jquery";+(function( $ ){$.fn.idle = function(options) {diff --git a/web/webpack.config.ts b/web/webpack.config.tsindex 4dcdad54553..28cd88d47d4 100644--- a/web/webpack.config.ts+++ b/web/webpack.config.ts@@ -1,7 +1,6 @@/// <reference types="webpack-dev-server" />import path from "node:path";-import * as url from "node:url";import type {ZopfliOptions} from "@gfx/zopfli";import {gzip} from "@gfx/zopfli";@@ -93,11 +92,6 @@ const config = (loader: "expose-loader",options: {exposes: "require"},},- {- test: url.fileURLToPath(import.meta.resolve("jquery")),- loader: "expose-loader",- options: {exposes: ["$", "jQuery"]},- },// Generate webfont{test: /\.font\.cjs$/,