diff --git a/package.json b/package.json index 9ba0e41ce2..a457f170cf 100644 --- a/package.json +++ b/package.json @@ -75,8 +75,8 @@ "url-loader": "^4.1.1", "webfonts-loader": "^7.0.1", "webpack": "^4.33.0", + "webpack-bundle-tracker": "^1.0.0-alpha.1", "webpack-cli": "^3.3.2", - "webpack4-bundle-tracker": "^0.0.1-beta", "winchan": "^0.2.1", "xvfb": "^0.4.0", "zxcvbn": "^4.4.2" diff --git a/static/js/types/webpack4-bundle-tracker/index.d.ts b/static/js/types/webpack4-bundle-tracker/index.d.ts deleted file mode 100644 index e08c8b50b1..0000000000 --- a/static/js/types/webpack4-bundle-tracker/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {Plugin} from "webpack"; - -declare namespace BundleTracker { - interface Options { - path?: string; - filename?: string; - publicPath?: string; - logTime?: boolean; - } -} - -declare class BundleTracker extends Plugin { - constructor(options?: BundleTracker.Options); -} - -export = BundleTracker; diff --git a/tools/webpack b/tools/webpack index 4067f472cd..300cf4adff 100755 --- a/tools/webpack +++ b/tools/webpack @@ -91,20 +91,11 @@ def build_for_most_tests() -> None: # configuration for ALL tests, but figuring out the full history here # was out of the scope of the effort here to add some comments and # clean up names. - entries = {} with open("tools/webpack.assets.json") as json_data: - for entry in json.load(json_data).keys(): - entries[entry] = [ - { - "name": f"{entry}.js", - "publicPath": f"http://localhost:3000/webpack-stub/{entry}-stubentry.js", - "path": f"/stubfolder/{entry}-stubfile.js", - } - ] + entries = json.load(json_data) stat_data = { "status": "done", - "chunks": entries, - "entryPoints": {name: [chunk] for name, chunk in entries.items()}, + "chunks": {entry: [f"{entry}-stubentry.js"] for entry in entries}, } directory = "var" if not os.path.exists(directory): diff --git a/version.py b/version.py index 6bd2c7873f..f6c09a7987 100644 --- a/version.py +++ b/version.py @@ -45,4 +45,4 @@ API_FEATURE_LEVEL = 47 # historical commits sharing the same major version, in which case a # minor version bump suffices. -PROVISION_VERSION = "135.1" +PROVISION_VERSION = "136.0" diff --git a/webpack.config.ts b/webpack.config.ts index 36b5f6ff46..275a5fce20 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -8,7 +8,7 @@ import MiniCssExtractPlugin from "mini-css-extract-plugin"; import OptimizeCssAssetsPlugin from "optimize-css-assets-webpack-plugin"; import TerserPlugin from "terser-webpack-plugin"; import webpack from "webpack"; -import BundleTracker from "webpack4-bundle-tracker"; +import BundleTracker from "webpack-bundle-tracker"; import DebugRequirePlugin from "./tools/debug-require-webpack-plugin"; import assets from "./tools/webpack.assets.json"; @@ -243,8 +243,13 @@ export default (_env: unknown, argv: {mode?: string}): webpack.Configuration[] = new DebugRequirePlugin(), new BundleTracker({ filename: production - ? "webpack-stats-production.json" - : "var/webpack-stats-dev.json", + ? "../../webpack-stats-production.json" + : "../../var/webpack-stats-dev.json", + relativePath: true, + // Respecify many defaults until https://github.com/django-webpack/webpack-bundle-tracker/pull/55 is merged + path: path.resolve(__dirname, "static/webpack-bundles"), + integrity: false, + integrityHashes: [], }), ...(production ? [] diff --git a/yarn.lock b/yarn.lock index b2f0585128..19c2b8fdfb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1347,6 +1347,25 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= +"@types/lodash.foreach@^4.4.6": + version "4.5.6" + resolved "https://registry.yarnpkg.com/@types/lodash.foreach/-/lodash.foreach-4.5.6.tgz#24735299139a739e436ab4fb8a6a31ca3d54bbb3" + integrity sha512-A8+157A+27zwJSstmW/eWPc9lHLJNEer4jiMlsyxWieBxEx0arwB9vgQm+iai6DEDYYQuufHrzVhQOiapCalQQ== + dependencies: + "@types/lodash" "*" + +"@types/lodash.get@^4.4.6": + version "4.4.6" + resolved "https://registry.yarnpkg.com/@types/lodash.get/-/lodash.get-4.4.6.tgz#0c7ac56243dae0f9f09ab6f75b29471e2e777240" + integrity sha512-E6zzjR3GtNig8UJG/yodBeJeIOtgPkMgsLjDU3CbgCAPC++vJ0eCMnJhVpRZb/ENqEFlov1+3K9TKtY4UdWKtQ== + dependencies: + "@types/lodash" "*" + +"@types/lodash@*": + version "4.14.168" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008" + integrity sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q== + "@types/mdast@^3.0.0": version "3.0.3" resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.3.tgz#2d7d671b1cd1ea3deb306ea75036c2a0407d2deb" @@ -1974,11 +1993,6 @@ ansi-html@0.0.7: resolved "https://registry.yarnpkg.com/ansi-html/-/ansi-html-0.0.7.tgz#813584021962a9e9e6fd039f940d12f56ca7859e" integrity sha1-gTWEAhliqenm/QOflA0S9WynhZ4= -ansi-regex@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-1.1.1.tgz#41c847194646375e6a1a5d10c3ca054ef9fc980d" - integrity sha1-QchHGUZGN15qGl0Qw8oFTvn8mA0= - ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -4183,11 +4197,6 @@ deep-equal@^1.0.1: object-keys "^1.1.1" regexp.prototype.flags "^1.2.0" -deep-extend@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" - integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== - deep-is@^0.1.3, deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -7941,6 +7950,11 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +lodash.assign@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" + integrity sha1-DZnzzNem0mHRm9rrkkUAXShYCOc= + lodash.clonedeep@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" @@ -7951,6 +7965,11 @@ lodash.debounce@^4.0.8: resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= +lodash.defaults@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" + integrity sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw= + lodash.flatmap@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.flatmap/-/lodash.flatmap-4.5.0.tgz#ef8cbf408f6e48268663345305c6acc0b778702e" @@ -7966,6 +7985,11 @@ lodash.flattendeep@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" integrity sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI= +lodash.foreach@^4.2.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.foreach/-/lodash.foreach-4.5.0.tgz#1a6a35eace401280c7f06dddec35165ab27e3e53" + integrity sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM= + lodash.get@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" @@ -11989,13 +12013,6 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -strip-ansi@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-2.0.1.tgz#df62c1aa94ed2f114e1d0f21fd1d50482b79a60e" - integrity sha1-32LBqpTtLxFOHQ8h/R1QSCt5pg4= - dependencies: - ansi-regex "^1.0.0" - strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" @@ -13516,6 +13533,19 @@ webidl-conversions@^6.1.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-6.1.0.tgz#9111b4d7ea80acd40f5270d666621afa78b69514" integrity sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w== +webpack-bundle-tracker@^1.0.0-alpha.1: + version "1.0.0-alpha.1" + resolved "https://registry.yarnpkg.com/webpack-bundle-tracker/-/webpack-bundle-tracker-1.0.0-alpha.1.tgz#17b4f41df147d53989f3542b035bcde8c7c2dc00" + integrity sha512-kyLrwD0ZeINe76pevIsAQY49lRrSfw01iCM6kbMi/Fb9m2LYJBv3up3ALcqf3ugiydy4vbaZ8NYTi4F2MxojVw== + dependencies: + "@types/lodash.foreach" "^4.4.6" + "@types/lodash.get" "^4.4.6" + lodash.assign "^4.2.0" + lodash.defaults "^4.2.0" + lodash.foreach "^4.2.0" + lodash.get "^4.4.2" + strip-ansi "^6.0.0" + webpack-cli@^3.3.2: version "3.3.12" resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-3.3.12.tgz#94e9ada081453cd0aa609c99e500012fd3ad2d4a" @@ -13599,15 +13629,6 @@ webpack-sources@^1.1.0, webpack-sources@^1.4.0, webpack-sources@^1.4.1, webpack- source-list-map "^2.0.0" source-map "~0.6.1" -webpack4-bundle-tracker@^0.0.1-beta: - version "0.0.1-beta" - resolved "https://registry.yarnpkg.com/webpack4-bundle-tracker/-/webpack4-bundle-tracker-0.0.1-beta.tgz#f576821ffbce584206e8dd41ba10cf9a7738731a" - integrity sha512-UcCqw8LT2IqqZhZDKPw9FAtWvHarS5iGYmw/aaWupSI1q55qdj7fjGsbiK/O/PxOuaAjfVxMVLq2CBvCbdp+XA== - dependencies: - deep-extend "^0.6.0" - mkdirp "^0.5.1" - strip-ansi "^2.0.1" - webpack@^4.33.0: version "4.46.0" resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.46.0.tgz#bf9b4404ea20a073605e0a011d188d77cb6ad542" diff --git a/zerver/templatetags/app_filters.py b/zerver/templatetags/app_filters.py index d577100bb2..728437cfe3 100644 --- a/zerver/templatetags/app_filters.py +++ b/zerver/templatetags/app_filters.py @@ -178,7 +178,7 @@ def webpack_entry(entrypoint: str) -> List[str]: with open(settings.WEBPACK_STATS_FILE, "rb") as f: stats = orjson.loads(f.read()) status = stats["status"] - if not settings.DEBUG or status != "compiling": + if not settings.DEBUG or status != "compile": break time.sleep(0.2) @@ -186,11 +186,7 @@ def webpack_entry(entrypoint: str) -> List[str]: raise RuntimeError("Webpack compilation was not successful") return [ - chunk_file["publicPath"] - if "publicPath" in chunk_file - else staticfiles_storage.url(settings.WEBPACK_BUNDLES + chunk_file["name"]) - for chunk in stats["entryPoints"][entrypoint] - for chunk_file in chunk - if chunk_file["name"].endswith((".css", ".js")) - and not chunk_file["name"].endswith(".hot-update.js") + staticfiles_storage.url(settings.WEBPACK_BUNDLES + filename) + for filename in stats["chunks"][entrypoint] + if filename.endswith((".css", ".js")) and not filename.endswith(".hot-update.js") ]