From 87c95d471802178a2be186c9de51bff1c4264068 Mon Sep 17 00:00:00 2001 From: Ian Clanton-Thuon Date: Mon, 6 Oct 2025 21:18:59 -0700 Subject: [PATCH 01/24] Initial implementation of a RSPack Heft plugin. --- .../rush/nonbrowser-approved-packages.json | 4 + .../config/subspaces/default/pnpm-lock.yaml | 217 +++++++++++++ heft-plugins/heft-rspack-plugin/.eslintrc.js | 10 + heft-plugins/heft-rspack-plugin/.npmignore | 31 ++ heft-plugins/heft-rspack-plugin/LICENSE | 24 ++ heft-plugins/heft-rspack-plugin/README.md | 10 + .../config/api-extractor.json | 16 + .../config/jest.config.json | 3 + .../heft-rspack-plugin/config/rig.json | 7 + heft-plugins/heft-rspack-plugin/package.json | 34 ++ .../src/RspackConfigurationLoader.ts | 125 ++++++++ .../heft-rspack-plugin/src/RspackPlugin.ts | 301 ++++++++++++++++++ heft-plugins/heft-rspack-plugin/src/index.ts | 13 + heft-plugins/heft-rspack-plugin/src/shared.ts | 36 +++ heft-plugins/heft-rspack-plugin/tsconfig.json | 7 + rush.json | 7 + 16 files changed, 845 insertions(+) create mode 100644 heft-plugins/heft-rspack-plugin/.eslintrc.js create mode 100644 heft-plugins/heft-rspack-plugin/.npmignore create mode 100644 heft-plugins/heft-rspack-plugin/LICENSE create mode 100644 heft-plugins/heft-rspack-plugin/README.md create mode 100644 heft-plugins/heft-rspack-plugin/config/api-extractor.json create mode 100644 heft-plugins/heft-rspack-plugin/config/jest.config.json create mode 100644 heft-plugins/heft-rspack-plugin/config/rig.json create mode 100644 heft-plugins/heft-rspack-plugin/package.json create mode 100644 heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts create mode 100644 heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts create mode 100644 heft-plugins/heft-rspack-plugin/src/index.ts create mode 100644 heft-plugins/heft-rspack-plugin/src/shared.ts create mode 100644 heft-plugins/heft-rspack-plugin/tsconfig.json diff --git a/common/config/rush/nonbrowser-approved-packages.json b/common/config/rush/nonbrowser-approved-packages.json index 164d3881b80..52f8402a76c 100644 --- a/common/config/rush/nonbrowser-approved-packages.json +++ b/common/config/rush/nonbrowser-approved-packages.json @@ -122,6 +122,10 @@ "name": "@redis/client", "allowedCategories": [ "libraries" ] }, + { + "name": "@rspack/core", + "allowedCategories": [ "libraries" ] + }, { "name": "@rushstack/debug-certificate-manager", "allowedCategories": [ "libraries", "vscode-extensions" ] diff --git a/common/config/subspaces/default/pnpm-lock.yaml b/common/config/subspaces/default/pnpm-lock.yaml index cc55254a6c1..810438daa98 100644 --- a/common/config/subspaces/default/pnpm-lock.yaml +++ b/common/config/subspaces/default/pnpm-lock.yaml @@ -3019,6 +3019,28 @@ importers: specifier: workspace:* version: link:../../rigs/local-node-rig + ../../../heft-plugins/heft-rspack-plugin: + dependencies: + '@rushstack/node-core-library': + specifier: workspace:* + version: link:../../libraries/node-core-library + devDependencies: + '@rspack/core': + specifier: ^1.2.8 + version: 1.5.8 + '@rushstack/eslint-config': + specifier: workspace:* + version: link:../../eslint/eslint-config + '@rushstack/heft': + specifier: workspace:* + version: link:../../apps/heft + '@rushstack/heft-node-rig': + specifier: workspace:* + version: link:../../rigs/heft-node-rig + '@types/node': + specifier: 20.17.19 + version: 20.17.19 + ../../../heft-plugins/heft-sass-load-themed-styles-plugin: dependencies: '@microsoft/load-themed-styles': @@ -7639,6 +7661,31 @@ packages: engines: {node: '>=10.0.0'} dev: true + /@emnapi/core@1.5.0: + resolution: {integrity: sha512-sbP8GzB1WDzacS8fgNPpHlp6C9VZe+SJP3F90W9rLemaQj2PzIuTEl1qDOYQf58YIpyjViI24y9aPWCjEzY2cg==} + requiresBuild: true + dependencies: + '@emnapi/wasi-threads': 1.1.0 + tslib: 2.8.1 + dev: true + optional: true + + /@emnapi/runtime@1.5.0: + resolution: {integrity: sha512-97/BJ3iXHww3djw6hYIfErCZFee7qCtrneuLa20UXFCOTCfBM2cvQHjWJ2EG0s0MtdNwInarqCTz35i4wWXHsQ==} + requiresBuild: true + dependencies: + tslib: 2.8.1 + dev: true + optional: true + + /@emnapi/wasi-threads@1.1.0: + resolution: {integrity: sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==} + requiresBuild: true + dependencies: + tslib: 2.8.1 + dev: true + optional: true + /@emotion/cache@10.0.29: resolution: {integrity: sha512-fU2VtSVlHiF27empSbxi1O2JFdNWZO+2NFHfwO0pxgTep6Xa3uGb+3pVKfLww2l/IBGLNEZl5Xf/++A4wAYDYQ==} dependencies: @@ -10416,6 +10463,43 @@ packages: - supports-color dev: false + /@module-federation/error-codes@0.18.0: + resolution: {integrity: sha512-Woonm8ehyVIUPXChmbu80Zj6uJkC0dD9SJUZ/wOPtO8iiz/m+dkrOugAuKgoiR6qH4F+yorWila954tBz4uKsQ==} + dev: true + + /@module-federation/runtime-core@0.18.0: + resolution: {integrity: sha512-ZyYhrDyVAhUzriOsVfgL6vwd+5ebYm595Y13KeMf6TKDRoUHBMTLGQ8WM4TDj8JNsy7LigncK8C03fn97of0QQ==} + dependencies: + '@module-federation/error-codes': 0.18.0 + '@module-federation/sdk': 0.18.0 + dev: true + + /@module-federation/runtime-tools@0.18.0: + resolution: {integrity: sha512-fSga9o4t1UfXNV/Kh6qFvRyZpPp3EHSPRISNeyT8ZoTpzDNiYzhtw0BPUSSD8m6C6XQh2s/11rI4g80UY+d+hA==} + dependencies: + '@module-federation/runtime': 0.18.0 + '@module-federation/webpack-bundler-runtime': 0.18.0 + dev: true + + /@module-federation/runtime@0.18.0: + resolution: {integrity: sha512-+C4YtoSztM7nHwNyZl6dQKGUVJdsPrUdaf3HIKReg/GQbrt9uvOlUWo2NXMZ8vDAnf/QRrpSYAwXHmWDn9Obaw==} + dependencies: + '@module-federation/error-codes': 0.18.0 + '@module-federation/runtime-core': 0.18.0 + '@module-federation/sdk': 0.18.0 + dev: true + + /@module-federation/sdk@0.18.0: + resolution: {integrity: sha512-Lo/Feq73tO2unjmpRfyyoUkTVoejhItXOk/h5C+4cistnHbTV8XHrW/13fD5e1Iu60heVdAhhelJd6F898Ve9A==} + dev: true + + /@module-federation/webpack-bundler-runtime@0.18.0: + resolution: {integrity: sha512-TEvErbF+YQ+6IFimhUYKK3a5wapD90d90sLsNpcu2kB3QGT7t4nIluE25duXuZDVUKLz86tEPrza/oaaCWTpvQ==} + dependencies: + '@module-federation/runtime': 0.18.0 + '@module-federation/sdk': 0.18.0 + dev: true + /@mrmlnc/readdir-enhanced@2.2.1: resolution: {integrity: sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==} engines: {node: '>=4'} @@ -10424,6 +10508,16 @@ packages: glob-to-regexp: 0.3.0 dev: true + /@napi-rs/wasm-runtime@1.0.6: + resolution: {integrity: sha512-DXj75ewm11LIWUk198QSKUTxjyRjsBwk09MuMk5DGK+GDUtyPhhEHOGP/Xwwj3DjQXXkivoBirmOnKrLfc0+9g==} + requiresBuild: true + dependencies: + '@emnapi/core': 1.5.0 + '@emnapi/runtime': 1.5.0 + '@tybys/wasm-util': 0.10.1 + dev: true + optional: true + /@nodelib/fs.scandir@2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -11147,6 +11241,121 @@ packages: engines: {node: '>=14.0.0'} dev: true + /@rspack/binding-darwin-arm64@1.5.8: + resolution: {integrity: sha512-spJfpOSN3f7V90ic45/ET2NKB2ujAViCNmqb0iGurMNQtFRq+7Kd+jvVKKGXKBHBbsQrFhidSWbbqy2PBPGK8g==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@rspack/binding-darwin-x64@1.5.8: + resolution: {integrity: sha512-YFOzeL1IBknBcri8vjUp43dfUBylCeQnD+9O9p0wZmLAw7DtpN5JEOe2AkGo8kdTqJjYKI+cczJPKIw6lu1LWw==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@rspack/binding-linux-arm64-gnu@1.5.8: + resolution: {integrity: sha512-UAWCsOnpkvy8eAVRo0uipbHXDhnoDq5zmqWTMhpga0/a3yzCp2e+fnjZb/qnFNYb5MeL0O1mwMOYgn1M3oHILQ==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rspack/binding-linux-arm64-musl@1.5.8: + resolution: {integrity: sha512-GnSvGT4GjokPSD45cTtE+g7LgghuxSP1MRmvd+Vp/I8pnxTVSTsebRod4TAqyiv+l11nuS8yqNveK9qiOkBLWw==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rspack/binding-linux-x64-gnu@1.5.8: + resolution: {integrity: sha512-XLxh5n/pzUfxsugz/8rVBv+Tx2nqEM+9rharK69kfooDsQNKyz7PANllBQ/v4svJ+W0BRHnDL4qXSGdteZeEjA==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rspack/binding-linux-x64-musl@1.5.8: + resolution: {integrity: sha512-gE0+MZmwF+01p9/svpEESkzkLpBkVUG2o03YMpwXYC/maeRRhWvF8BJ7R3i/Ls/jFGSE87dKX5NbRLVzqksq/w==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rspack/binding-wasm32-wasi@1.5.8: + resolution: {integrity: sha512-cfg3niNHeJuxuml1Vy9VvaJrI/5TakzoaZvKX2g5S24wfzR50Eyy4JAsZ+L2voWQQp1yMJbmPYPmnTCTxdJQBQ==} + cpu: [wasm32] + requiresBuild: true + dependencies: + '@napi-rs/wasm-runtime': 1.0.6 + dev: true + optional: true + + /@rspack/binding-win32-arm64-msvc@1.5.8: + resolution: {integrity: sha512-7i3ZTHFXKfU/9Jm9XhpMkrdkxO7lfeYMNVEGkuU5dyBfRMQj69dRgPL7zJwc2plXiqu9LUOl+TwDNTjap7Q36g==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rspack/binding-win32-ia32-msvc@1.5.8: + resolution: {integrity: sha512-7ZPPWO11J+soea1+mnfaPpQt7GIodBM7A86dx6PbXgVEoZmetcWPrCF2NBfXxQWOKJ9L3RYltC4z+ZyXRgMOrw==} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rspack/binding-win32-x64-msvc@1.5.8: + resolution: {integrity: sha512-N/zXQgzIxME3YUzXT8qnyzxjqcnXudWOeDh8CAG9zqTCnCiy16SFfQ/cQgEoLlD9geQntV6jx2GbDDI5kpDGMQ==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rspack/binding@1.5.8: + resolution: {integrity: sha512-/91CzhRl9r5BIQCgGsS7jA6MDbw1I2BQpbfcUUdkdKl2P79K3Zo/Mw/TvKzS86catwLaUQEgkGRmYawOfPg7ow==} + optionalDependencies: + '@rspack/binding-darwin-arm64': 1.5.8 + '@rspack/binding-darwin-x64': 1.5.8 + '@rspack/binding-linux-arm64-gnu': 1.5.8 + '@rspack/binding-linux-arm64-musl': 1.5.8 + '@rspack/binding-linux-x64-gnu': 1.5.8 + '@rspack/binding-linux-x64-musl': 1.5.8 + '@rspack/binding-wasm32-wasi': 1.5.8 + '@rspack/binding-win32-arm64-msvc': 1.5.8 + '@rspack/binding-win32-ia32-msvc': 1.5.8 + '@rspack/binding-win32-x64-msvc': 1.5.8 + dev: true + + /@rspack/core@1.5.8: + resolution: {integrity: sha512-sUd2LfiDhqYVfvknuoz0+/c+wSpn693xotnG5g1CSWKZArbtwiYzBIVnNlcHGmuoBRsnj/TkSq8dTQ7gwfBroQ==} + engines: {node: '>=18.12.0'} + peerDependencies: + '@swc/helpers': '>=0.5.1' + peerDependenciesMeta: + '@swc/helpers': + optional: true + dependencies: + '@module-federation/runtime-tools': 0.18.0 + '@rspack/binding': 1.5.8 + '@rspack/lite-tapable': 1.0.1 + dev: true + + /@rspack/lite-tapable@1.0.1: + resolution: {integrity: sha512-VynGOEsVw2s8TAlLf/uESfrgfrq2+rcXB1muPJYBWbsm1Oa6r5qVQhjA5ggM6z/coYPrsVMgovl3Ff7Q7OCp1w==} + engines: {node: '>=16.0.0'} + dev: true + /@rtsao/scc@1.1.0: resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==} dev: false @@ -13770,6 +13979,14 @@ packages: engines: {node: '>=10.13.0'} dev: false + /@tybys/wasm-util@0.10.1: + resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==} + requiresBuild: true + dependencies: + tslib: 2.8.1 + dev: true + optional: true + /@types/argparse@1.0.38: resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==} diff --git a/heft-plugins/heft-rspack-plugin/.eslintrc.js b/heft-plugins/heft-rspack-plugin/.eslintrc.js new file mode 100644 index 00000000000..4c934799d67 --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/.eslintrc.js @@ -0,0 +1,10 @@ +// This is a workaround for https://github.com/eslint/eslint/issues/3458 +require('@rushstack/eslint-config/patch/modern-module-resolution'); + +module.exports = { + extends: [ + '@rushstack/eslint-config/profile/node-trusted-tool', + '@rushstack/eslint-config/mixins/friendly-locals' + ], + parserOptions: { tsconfigRootDir: __dirname } +}; diff --git a/heft-plugins/heft-rspack-plugin/.npmignore b/heft-plugins/heft-rspack-plugin/.npmignore new file mode 100644 index 00000000000..ad6bcd960e8 --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/.npmignore @@ -0,0 +1,31 @@ +# THIS IS A STANDARD TEMPLATE FOR .npmignore FILES IN THIS REPO. + +# Ignore all files by default, to avoid accidentally publishing unintended files. +* + +# Use negative patterns to bring back the specific things we want to publish. +!/bin/** +!/lib/** +!/lib-*/** +!/dist/** +!ThirdPartyNotice.txt + +# Ignore certain patterns that should not get published. +/dist/*.stats.* +/lib/**/test/ +/lib-*/**/test/ +*.test.js + +# NOTE: These don't need to be specified, because NPM includes them automatically. +# +# package.json +# README (and its variants) +# CHANGELOG (and its variants) +# LICENSE / LICENCE + +#-------------------------------------------- +# DO NOT MODIFY THE TEMPLATE ABOVE THIS LINE +#-------------------------------------------- + +# (Add your project-specific overrides here) +!/includes/** diff --git a/heft-plugins/heft-rspack-plugin/LICENSE b/heft-plugins/heft-rspack-plugin/LICENSE new file mode 100644 index 00000000000..53dca6cd336 --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/LICENSE @@ -0,0 +1,24 @@ +@rushstack/heft-rspack-plugin + +Copyright (c) Microsoft Corporation. All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +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. diff --git a/heft-plugins/heft-rspack-plugin/README.md b/heft-plugins/heft-rspack-plugin/README.md new file mode 100644 index 00000000000..1beae62cbf5 --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/README.md @@ -0,0 +1,10 @@ +# @rushstack/heft-rspack-plugin + +This is a Heft plugin for using RSPack during the "bundle" stage. + +## Links + +- [CHANGELOG.md](https://github.com/microsoft/rushstack/blob/main/heft-plugins/heft-rspack-plugin/CHANGELOG.md) - Find + out what's new in the latest version + +Heft is part of the [Rush Stack](https://rushstack.io/) family of projects. diff --git a/heft-plugins/heft-rspack-plugin/config/api-extractor.json b/heft-plugins/heft-rspack-plugin/config/api-extractor.json new file mode 100644 index 00000000000..74590d3c4f8 --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/config/api-extractor.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + + "mainEntryPointFilePath": "/lib/index.d.ts", + "apiReport": { + "enabled": true, + "reportFolder": "../../../common/reviews/api" + }, + "docModel": { + "enabled": false + }, + "dtsRollup": { + "enabled": true, + "betaTrimmedFilePath": "/dist/.d.ts" + } +} diff --git a/heft-plugins/heft-rspack-plugin/config/jest.config.json b/heft-plugins/heft-rspack-plugin/config/jest.config.json new file mode 100644 index 00000000000..4bb17bde3ee --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/config/jest.config.json @@ -0,0 +1,3 @@ +{ + "extends": "@rushstack/heft-node-rig/profiles/default/config/jest.config.json" +} diff --git a/heft-plugins/heft-rspack-plugin/config/rig.json b/heft-plugins/heft-rspack-plugin/config/rig.json new file mode 100644 index 00000000000..6ac88a96368 --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/config/rig.json @@ -0,0 +1,7 @@ +{ + // The "rig.json" file directs tools to look for their config files in an external package. + // Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + + "rigPackageName": "@rushstack/heft-node-rig" +} diff --git a/heft-plugins/heft-rspack-plugin/package.json b/heft-plugins/heft-rspack-plugin/package.json new file mode 100644 index 00000000000..acbb9eda6e0 --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/package.json @@ -0,0 +1,34 @@ +{ + "name": "@rushstack/heft-rspack-plugin", + "version": "0.0.0", + "description": "Heft plugin for RSPack", + "repository": { + "type": "git", + "url": "https://github.com/microsoft/rushstack.git", + "directory": "heft-plugins/heft-rspack-plugin" + }, + "homepage": "https://rushstack.io/pages/heft/overview/", + "main": "lib/index.js", + "types": "dist/heft-rspack-plugin.d.ts", + "license": "MIT", + "scripts": { + "build": "heft build --clean", + "start": "heft test --clean --watch", + "_phase:build": "heft build --clean", + "_phase:test": "heft test --no-build" + }, + "peerDependencies": { + "@rushstack/heft": "^0.49.7", + "@rspack/core": "^0.1.1" + }, + "dependencies": { + "@rushstack/node-core-library": "workspace:*" + }, + "devDependencies": { + "@rushstack/eslint-config": "workspace:*", + "@rushstack/heft": "workspace:*", + "@rushstack/heft-node-rig": "workspace:*", + "@types/node": "20.17.19", + "@rspack/core": "^1.2.8" + } +} diff --git a/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts b/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts new file mode 100644 index 00000000000..a2254847615 --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +import * as path from 'path'; +import { type FolderItem, FileSystem } from '@rushstack/node-core-library'; +import type * as rspack from '@rspack/core'; +import type { IBuildStageProperties, ScopedLogger } from '@rushstack/heft'; + +import { IRspackConfiguration } from './shared'; + +interface IRspackConfigFunctionEnv { + prod: boolean; + production: boolean; +} +type IRspackConfigJsExport = + | rspack.Configuration + | rspack.Configuration[] + | Promise + | Promise + | ((env: IRspackConfigFunctionEnv) => rspack.Configuration | rspack.Configuration[]) + | ((env: IRspackConfigFunctionEnv) => Promise); +type IRspackConfigJs = IRspackConfigJsExport | { default: IRspackConfigJsExport }; + +interface IRspackConfigFileNames { + dev: string | undefined; + prod: string | undefined; +} + +export class RspackConfigurationLoader { + public static async tryLoadRspackConfigAsync( + logger: ScopedLogger, + buildFolder: string, + buildProperties: IBuildStageProperties + ): Promise { + const rspackConfigFiles: IRspackConfigFileNames | undefined = await findRspackConfigAsync(buildFolder); + const rspackDevConfigFilename: string | undefined = rspackConfigFiles.dev; + const rspackConfigFilename: string | undefined = rspackConfigFiles.prod; + + let rspackConfigJs: IRspackConfigJs | undefined; + + try { + if (buildProperties.serveMode && rspackDevConfigFilename) { + logger.terminal.writeVerboseLine( + `Attempting to load rspack configuration from "${rspackDevConfigFilename}".` + ); + rspackConfigJs = RspackConfigurationLoader._tryLoadRspackConfiguration( + buildFolder, + rspackDevConfigFilename + ); + } + + if (!rspackConfigJs && rspackConfigFilename) { + logger.terminal.writeVerboseLine( + `Attempting to load rspack configuration from "${rspackConfigFilename}".` + ); + rspackConfigJs = RspackConfigurationLoader._tryLoadRspackConfiguration( + buildFolder, + rspackConfigFilename + ); + } + } catch (error) { + logger.emitError(error as Error); + } + + if (rspackConfigJs) { + const rspackConfig: IRspackConfigJsExport = + (rspackConfigJs as { default: IRspackConfigJsExport }).default || rspackConfigJs; + + if (typeof rspackConfig === 'function') { + return rspackConfig({ prod: buildProperties.production, production: buildProperties.production }); + } else { + return rspackConfig; + } + } else { + return undefined; + } + } + + private static _tryLoadRspackConfiguration( + buildFolder: string, + configurationFilename: string + ): IRspackConfigJs | undefined { + const fullRspackConfigPath: string = path.join(buildFolder, configurationFilename); + if (FileSystem.exists(fullRspackConfigPath)) { + try { + return require(fullRspackConfigPath); + } catch (e) { + throw new Error(`Error loading rspack configuration at "${fullRspackConfigPath}": ${e}`); + } + } else { + return undefined; + } + } +} + +async function findRspackConfigAsync(buildFolder: string): Promise { + try { + const folderItems: FolderItem[] = await FileSystem.readFolderItemsAsync(buildFolder); + const dev: string[] = []; + const prod: string[] = []; + + for (const folderItem of folderItems) { + if (folderItem.isFile()) { + if (folderItem.name.match(/^rspack.dev.config\.(cjs|js|mjs)$/)) { + dev.push(folderItem.name); + } else if (folderItem.name.match(/^rspack.config\.(cjs|js|mjs)$/)) { + prod.push(folderItem.name); + } + } + } + + if (dev.length > 1) { + throw new Error(`Error: Found more than one dev rspack configuration file.`); + } else if (prod.length > 1) { + throw new Error(`Error: Found more than one non-dev rspack configuration file.`); + } + + return { + dev: dev[0], + prod: prod[0] + }; + } catch (e) { + throw new Error(`Error finding rspack configuration: ${e}`); + } +} diff --git a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts new file mode 100644 index 00000000000..59d4cbcce33 --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +import type { + Compiler as RspackCompiler, + MultiCompiler as RspackMultiCompiler, + Stats as RspackStats, + StatsCompilation as RspackStatsCompilation + // DevServer as RspackDevServer, +} from '@rspack/core'; +import { LegacyAdapters, Import, IPackageJson, PackageJsonLookup } from '@rushstack/node-core-library'; +import type { + HeftConfiguration, + HeftSession, + IBuildStageContext, + IBuildStageProperties, + IBundleSubstage, + IHeftPlugin, + ScopedLogger +} from '@rushstack/heft'; +import type { + IRspackConfiguration, + IRspackBundleSubstageProperties, + IRspackBuildStageProperties +} from './shared'; +import { RspackConfigurationLoader } from './RspackConfigurationLoader'; + +const PLUGIN_NAME: string = 'RspackPlugin'; + +/** + * @internal + */ +export class RspackPlugin implements IHeftPlugin { + public readonly pluginName: string = PLUGIN_NAME; + + private static _rspackVersion: string | undefined; + private static _rspack: typeof import('@rspack/core') | undefined; + + private static async _ensureRspackAsync(): Promise { + if (!RspackPlugin._rspack) { + // eslint-disable-next-line require-atomic-updates + RspackPlugin._rspack = await import('@rspack/core'); + } + + return RspackPlugin._rspack; + } + + private static _getRspackVersion(): string { + if (!RspackPlugin._rspackVersion) { + const rspackCorePackageJsonPath: string = Import.resolveModule({ + modulePath: '@rspack/core/package.json', + baseFolderPath: __dirname + }); + const rspackCorePackageJson: IPackageJson = + PackageJsonLookup.instance.loadPackageJson(rspackCorePackageJsonPath); + + RspackPlugin._rspackVersion = rspackCorePackageJson.version; + } + + return RspackPlugin._rspackVersion; + } + + public apply(heftSession: HeftSession, heftConfiguration: HeftConfiguration): void { + heftSession.hooks.build.tap(PLUGIN_NAME, (build: IBuildStageContext) => { + build.hooks.bundle.tap(PLUGIN_NAME, (bundle: IBundleSubstage) => { + bundle.hooks.configureWebpack.tapPromise(PLUGIN_NAME, async (existingConfiguration: unknown) => { + const logger: ScopedLogger = heftSession.requestScopedLogger('configure-rspack'); + if (existingConfiguration) { + logger.terminal.writeVerboseLine( + 'Skipping loading rspack config file because the rspack config has already been set.' + ); + return existingConfiguration; + } else { + return await RspackConfigurationLoader.tryLoadRspackConfigAsync( + logger, + heftConfiguration.buildFolder, + build.properties + ); + } + }); + + bundle.hooks.run.tapPromise(PLUGIN_NAME, async () => { + await this._runRspackAsync( + heftSession, + heftConfiguration, + bundle.properties as IRspackBundleSubstageProperties, + build.properties, + heftConfiguration.terminalProvider.supportsColor + ); + }); + }); + }); + } + + private async _runRspackAsync( + heftSession: HeftSession, + heftConfiguration: HeftConfiguration, + bundleSubstageProperties: IRspackBundleSubstageProperties, + buildProperties: IBuildStageProperties, + supportsColor: boolean + ): Promise { + const rspackConfiguration: IRspackConfiguration | undefined | null = + bundleSubstageProperties.rspackConfiguration; + if (!rspackConfiguration) { + return; + } + + const logger: ScopedLogger = heftSession.requestScopedLogger('rspack'); + + // TODO: Do some version checking + + logger.terminal.writeLine(`Using Rspack version ${RspackPlugin._getRspackVersion()}`); + + let compiler: RspackCompiler | RspackMultiCompiler; + const { rspack } = await RspackPlugin._ensureRspackAsync(); + if (Array.isArray(rspackConfiguration)) { + if (rspackConfiguration.length === 0) { + logger.terminal.writeLine('The rspack configuration is an empty array - nothing to do.'); + return; + } else { + compiler = rspack(rspackConfiguration); + } + } else { + compiler = rspack(rspackConfiguration); + } + + if (buildProperties.serveMode) { + // TODO: Get dev server configuration working + // const defaultDevServerOptions: RspackDevServer = { + // host: 'localhost', + // devMiddleware: { + // publicPath: '/', + // stats: { + // cached: false, + // cachedAssets: false, + // colors: supportsColor + // } + // }, + // client: { + // logging: 'info', + // webSocketURL: { + // port: 8080 + // } + // }, + // port: 8080 + // }; + // let options: RspackDevServer; + // if (Array.isArray(rspackConfiguration)) { + // const devServerOptions: RspackDevServer[] = rspackConfiguration + // .map((configuration) => configuration.devServer) + // .filter((devServer): devServer is RspackDevServer => !!devServer); + // if (devServerOptions.length > 1) { + // logger.emitWarning( + // new Error(`Detected multiple webpack devServer configurations, using the first one.`) + // ); + // } + // if (devServerOptions.length > 0) { + // options = { ...defaultDevServerOptions, ...devServerOptions[0] }; + // } else { + // options = defaultDevServerOptions; + // } + // } else { + // options = { ...defaultDevServerOptions, ...rspackConfiguration.devServer }; + // } + // // Register a plugin to callback after webpack is done with the first compilation + // // so we can move on to post-build + // let firstCompilationDoneCallback: (() => void) | undefined; + // const originalBeforeCallback: typeof options.setupMiddlewares | undefined = options.setupMiddlewares; + // options.setupMiddlewares = (middlewares, devServer) => { + // compiler.hooks.done.tap('heft-webpack-plugin', () => { + // if (firstCompilationDoneCallback) { + // firstCompilationDoneCallback(); + // firstCompilationDoneCallback = undefined; + // } + // }); + // if (originalBeforeCallback) { + // return originalBeforeCallback(middlewares, devServer); + // } + // return middlewares; + // }; + // // The webpack-dev-server package has a design flaw, where merely loading its package will set the + // // WEBPACK_DEV_SERVER environment variable -- even if no APIs are accessed. This environment variable + // // causes incorrect behavior if Heft is not running in serve mode. Thus, we need to be careful to call require() + // // only if Heft is in serve mode. + // const WebpackDevServer: typeof TWebpackDevServer = require(WEBPACK_DEV_SERVER_PACKAGE_NAME); + // // TODO: the WebpackDevServer accepts a third parameter for a logger. We should make + // // use of that to make logging cleaner + // const webpackDevServer: TWebpackDevServer = new WebpackDevServer(options, compiler); + // await new Promise((resolve: () => void, reject: (error: Error) => void) => { + // firstCompilationDoneCallback = resolve; + // // Wrap in promise.resolve due to small issue in the type declaration, return type should be + // // webpackDevServer.start(): Promise; + // Promise.resolve(webpackDevServer.start()).catch(reject); + // }); + } else { + // TODO: Ensure check for too-early loading of webpack-dev-server + // if (process.env[WEBPACK_DEV_SERVER_ENV_VAR_NAME]) { + // logger.emitWarning( + // new Error( + // `The "${WEBPACK_DEV_SERVER_ENV_VAR_NAME}" environment variable is set, ` + + // 'which will cause problems when webpack is not running in serve mode. ' + + // `(Did a dependency inadvertently load the "${WEBPACK_DEV_SERVER_PACKAGE_NAME}" package?)` + // ) + // ); + // } + + let stats: RspackStats | undefined; + if (buildProperties.watchMode) { + try { + stats = await LegacyAdapters.convertCallbackToPromise( + (compiler as RspackCompiler).watch.bind(compiler), + {} + ); + } catch (e) { + logger.emitError(e as Error); + } + } else { + try { + stats = await LegacyAdapters.convertCallbackToPromise( + (compiler as RspackCompiler).run.bind(compiler) + ); + await new Promise((resolve, reject) => { + // The close() function's callback does not return an error. + // TODO: Ensure that it can't error + compiler.close(resolve); + }); + } catch (e) { + logger.emitError(e as Error); + } + } + + if (stats) { + // eslint-disable-next-line require-atomic-updates + (buildProperties as IRspackBuildStageProperties).rspackStats = stats; + + this._emitErrors(logger, heftConfiguration.buildFolder, stats); + } + } + } + + private _emitErrors(logger: ScopedLogger, buildFolder: string, stats: RspackStats): void { + if (stats.hasErrors() || stats.hasWarnings()) { + const serializedStats: RspackStatsCompilation[] = [stats.toJson('errors-warnings')]; + + const errors: Error[] = []; + const warnings: Error[] = []; + + for (const compilationStats of serializedStats) { + if (compilationStats.warnings) { + for (const warning of compilationStats.warnings) { + warnings.push(this._normalizeError(buildFolder, warning)); + } + } + + if (compilationStats.errors) { + for (const error of compilationStats.errors) { + errors.push(this._normalizeError(buildFolder, error)); + } + } + + if (compilationStats.children) { + for (const child of compilationStats.children) { + serializedStats.push(child); + } + } + } + + for (const warning of warnings) { + logger.emitWarning(warning); + } + + for (const error of errors) { + logger.emitError(error); + } + } + } + + private _normalizeError(buildFolder: string, error: unknown): Error { + if (error instanceof Error) { + return error; + } else { + // TODO: Handle better formatting of errors + return error as Error; + // let moduleName: string | undefined = error.moduleName; + // if (!moduleName && error.moduleIdentifier) { + // moduleName = Path.convertToSlashes(nodePath.relative(buildFolder, error.moduleIdentifier)); + // } + + // let formattedError: string; + // if (error.loc && moduleName) { + // formattedError = `${moduleName}:${error.loc} - ${error.message}`; + // } else if (moduleName) { + // formattedError = `${moduleName} - ${error.message}`; + // } else { + // formattedError = error.message; + // } + + // return new Error(formattedError); + } + } +} diff --git a/heft-plugins/heft-rspack-plugin/src/index.ts b/heft-plugins/heft-rspack-plugin/src/index.ts new file mode 100644 index 00000000000..5bd0f7b87e4 --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/src/index.ts @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +import type { IHeftPlugin } from '@rushstack/heft'; + +import { RspackPlugin } from './RspackPlugin'; + +export { IRspackConfiguration, IRspackBuildStageProperties, IRspackBundleSubstageProperties } from './shared'; + +/** + * @public + */ +export default new RspackPlugin() as IHeftPlugin; diff --git a/heft-plugins/heft-rspack-plugin/src/shared.ts b/heft-plugins/heft-rspack-plugin/src/shared.ts new file mode 100644 index 00000000000..960a496847f --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/src/shared.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +import type * as rspack from '@rspack/core'; +import type { IBuildStageProperties, IBundleSubstageProperties } from '@rushstack/heft'; + +/** + * @public + */ +export type IRspackConfiguration = rspack.Configuration | rspack.Configuration[] | undefined; + +/** + * @public + */ +export interface IRspackBundleSubstageProperties extends IBundleSubstageProperties { + /** + * The configuration used by the rspack plugin. This must be populated + * for rspack to run. If rspackConfigFilePath is specified, + * this will be populated automatically with the exports of the + * config file referenced in that property. + * + * @remarks + * Tapable event handlers can return `null` instead of `undefined` to suppress + * other handlers from creating a configuration object. + */ + // We are inheriting this problem from Tapable's API + // eslint-disable-next-line @rushstack/no-new-null + rspackConfiguration?: rspack.Configuration | rspack.Configuration[] | null; +} + +/** + * @public + */ +export interface IRspackBuildStageProperties extends IBuildStageProperties { + rspackStats?: rspack.Stats; +} diff --git a/heft-plugins/heft-rspack-plugin/tsconfig.json b/heft-plugins/heft-rspack-plugin/tsconfig.json new file mode 100644 index 00000000000..7512871fdbf --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", + + "compilerOptions": { + "types": ["node"] + } +} diff --git a/rush.json b/rush.json index 8464808210a..65dc161d4c3 100644 --- a/rush.json +++ b/rush.json @@ -1084,6 +1084,13 @@ "reviewCategory": "libraries", "shouldPublish": true }, + { + "packageName": "@rushstack/heft-rspack-plugin", + "projectFolder": "heft-plugins/heft-rspack-plugin", + "reviewCategory": "libraries" + // Not ready to publish yet + // "shouldPublish": true + }, { "packageName": "@rushstack/heft-sass-plugin", "projectFolder": "heft-plugins/heft-sass-plugin", From f3c1511f5f85e3018691774349f0a65b8c50818f Mon Sep 17 00:00:00 2001 From: Ian Clanton-Thuon Date: Mon, 24 Mar 2025 01:43:50 -0700 Subject: [PATCH 02/24] Update to use the new Heft API. --- common/config/rush/pnpm-config.json | 6 + .../build-tests-subspace/pnpm-lock.yaml | 2 +- .../config/subspaces/default/pnpm-lock.yaml | 71 +- heft-plugins/heft-rspack-plugin/README.md | 2 +- .../config/jest.config.json | 2 +- .../heft-rspack-plugin/config/rig.json | 2 +- .../heft-rspack-plugin/heft-plugin.json | 20 + heft-plugins/heft-rspack-plugin/package.json | 8 +- .../src/RspackConfigurationLoader.ts | 250 ++++--- .../heft-rspack-plugin/src/RspackPlugin.ts | 620 +++++++++++------- heft-plugins/heft-rspack-plugin/src/index.ts | 17 +- .../schemas/heft-rspack-plugin.schema.json | 25 + heft-plugins/heft-rspack-plugin/src/shared.ts | 115 +++- .../heft-webpack5-plugin/src/shared.ts | 4 +- .../WebpackConfigurationLoader.test.ts | 6 +- 15 files changed, 737 insertions(+), 413 deletions(-) create mode 100644 heft-plugins/heft-rspack-plugin/heft-plugin.json create mode 100644 heft-plugins/heft-rspack-plugin/src/schemas/heft-rspack-plugin.schema.json rename heft-plugins/heft-webpack5-plugin/src/{ => test}/WebpackConfigurationLoader.test.ts (97%) diff --git a/common/config/rush/pnpm-config.json b/common/config/rush/pnpm-config.json index 02f9faa2a00..228750b5ff7 100644 --- a/common/config/rush/pnpm-config.json +++ b/common/config/rush/pnpm-config.json @@ -418,6 +418,12 @@ "optional": true } } + }, + + "@rspack/core": { + "peerDependencies": { + "webpack-dev-server": "^5.0.4" + } } }, diff --git a/common/config/subspaces/build-tests-subspace/pnpm-lock.yaml b/common/config/subspaces/build-tests-subspace/pnpm-lock.yaml index 18d149cd86b..c95727e775b 100644 --- a/common/config/subspaces/build-tests-subspace/pnpm-lock.yaml +++ b/common/config/subspaces/build-tests-subspace/pnpm-lock.yaml @@ -13,7 +13,7 @@ overrides: '@rushstack/eslint-plugin@0.20.0>@typescript-eslint/utils': ~8.46.0 '@rushstack/heft-node-rig@2.10.1>eslint': ~9.37.0 -packageExtensionsChecksum: e59cfa9a35183eeeb6f2ac48c9ddd4b2 +packageExtensionsChecksum: 52f2427ae44b3da2019a3be8c1ee40b0 importers: diff --git a/common/config/subspaces/default/pnpm-lock.yaml b/common/config/subspaces/default/pnpm-lock.yaml index 810438daa98..812265d7c57 100644 --- a/common/config/subspaces/default/pnpm-lock.yaml +++ b/common/config/subspaces/default/pnpm-lock.yaml @@ -13,7 +13,7 @@ overrides: '@rushstack/eslint-plugin@0.20.0>@typescript-eslint/utils': ~8.46.0 '@rushstack/heft-node-rig@2.10.1>eslint': ~9.37.0 -packageExtensionsChecksum: e59cfa9a35183eeeb6f2ac48c9ddd4b2 +packageExtensionsChecksum: 52f2427ae44b3da2019a3be8c1ee40b0 importers: @@ -3021,9 +3021,21 @@ importers: ../../../heft-plugins/heft-rspack-plugin: dependencies: + '@rushstack/debug-certificate-manager': + specifier: workspace:* + version: link:../../libraries/debug-certificate-manager '@rushstack/node-core-library': specifier: workspace:* version: link:../../libraries/node-core-library + '@types/tapable': + specifier: 1.0.6 + version: 1.0.6 + tapable: + specifier: 1.1.3 + version: 1.1.3 + webpack-dev-server: + specifier: ^5.1.0 + version: 5.1.0(webpack@5.98.0) devDependencies: '@rspack/core': specifier: ^1.2.8 @@ -10331,7 +10343,6 @@ packages: /@leichtgewicht/ip-codec@2.0.4: resolution: {integrity: sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==} - dev: false /@mdx-js/loader@1.6.22(react@17.0.2): resolution: {integrity: sha512-9CjGwy595NaxAYp0hF9B/A0lH6C8Rms97e2JS9d3jVUtILn6pT5i5IV965ra3lIWc7Rs1GG1tBdVF7dCowYe6Q==} @@ -11342,6 +11353,7 @@ packages: engines: {node: '>=18.12.0'} peerDependencies: '@swc/helpers': '>=0.5.1' + webpack-dev-server: ^5.0.4 peerDependenciesMeta: '@swc/helpers': optional: true @@ -14029,7 +14041,6 @@ packages: resolution: {integrity: sha512-z9fJ5Im06zvUL548KvYNecEVlA7cVDkGUi6kZusb04mpyEFKCIZJvloCcmpmLaIahDpOQGHaHmG6imtPMmPXGQ==} dependencies: '@types/node': 17.0.41 - dev: false /@types/cacheable-request@6.0.3: resolution: {integrity: sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==} @@ -14070,7 +14081,6 @@ packages: dependencies: '@types/express-serve-static-core': 4.17.43 '@types/node': 17.0.41 - dev: false /@types/connect@3.4.38: resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} @@ -14333,7 +14343,6 @@ packages: resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==} dependencies: '@types/node': 17.0.41 - dev: false /@types/node@14.0.1: resolution: {integrity: sha512-FAYBGwC+W6F9+huFIDtn43cpy7+SzG+atzRiTfdp3inUKL2hXnd4rG8hylJLIh4+hqrQy1P17kvJByE/z825hA==} @@ -14455,7 +14464,6 @@ packages: /@types/retry@0.12.2: resolution: {integrity: sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==} - dev: false /@types/scheduler@0.16.8: resolution: {integrity: sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==} @@ -14477,7 +14485,6 @@ packages: resolution: {integrity: sha512-qLpGZ/c2fhSs5gnYsQxtDEq3Oy8SXPClIXkW5ghvAvsNuVSA8k+gCONcUCS/UjLEYvYps+e8uBtfgXgvhwfNug==} dependencies: '@types/express': 4.17.21 - dev: false /@types/serve-static@1.15.5: resolution: {integrity: sha512-PDRk21MnK70hja/YF8AHfC7yIsiQHn1rcXx7ijCFBX/k+XQJhQT/gw3xekXKJvx+5SXaMMS8oqQy09Mzvz2TuQ==} @@ -14490,7 +14497,6 @@ packages: resolution: {integrity: sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q==} dependencies: '@types/node': 17.0.41 - dev: false /@types/source-list-map@0.1.6: resolution: {integrity: sha512-5JcVt1u5HDmlXkwOD2nslZVllBBc7HDuOICfiZah2Z0is8M8g+ddAEawbmd3VjedfDHBzxCaXLs07QEmb7y54g==} @@ -14590,7 +14596,6 @@ packages: resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==} dependencies: '@types/node': 17.0.41 - dev: false /@types/ws@8.5.5: resolution: {integrity: sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==} @@ -16810,7 +16815,6 @@ packages: /batch@0.6.1: resolution: {integrity: sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==} - dev: false /better-opn@2.1.1: resolution: {integrity: sha512-kIPXZS5qwyKiX/HcRvDYfmBQUa8XP17I0mYZZ0y4UhpYOSvtsLHDYqmomS+Mj20aDvD3knEiQ0ecQy2nhio3yA==} @@ -16942,7 +16946,6 @@ packages: dependencies: fast-deep-equal: 3.1.3 multicast-dns: 7.2.5 - dev: false /boolbase@1.0.0: resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==} @@ -17156,7 +17159,6 @@ packages: engines: {node: '>=18'} dependencies: run-applescript: 7.0.0 - dev: false /buttono@1.0.4: resolution: {integrity: sha512-aLOeyK3zrhZnqvH6LzwIbjur8mkKhW8Xl3/jolX+RCJnGG354+L48q1SJWdky89uhQ/mBlTxY/d0x8+ciE0ZWw==} @@ -17758,7 +17760,6 @@ packages: /colorette@2.0.20: resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} - dev: false /colorjs.io@0.5.2: resolution: {integrity: sha512-twmVoizEW7ylZSN32OgKdXRmo1qg+wT5/6C3xu5b9QsWzSFAhHLn2xd8ro0diCsKfCj1RdaTP/nrcW+vAoQPIw==} @@ -17902,7 +17903,6 @@ packages: /connect-history-api-fallback@2.0.0: resolution: {integrity: sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==} engines: {node: '>=0.8'} - dev: false /console-browserify@1.2.0: resolution: {integrity: sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==} @@ -18547,7 +18547,6 @@ packages: /default-browser-id@5.0.0: resolution: {integrity: sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==} engines: {node: '>=18'} - dev: false /default-browser@5.2.1: resolution: {integrity: sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==} @@ -18555,7 +18554,6 @@ packages: dependencies: bundle-name: 4.1.0 default-browser-id: 5.0.0 - dev: false /default-gateway@6.0.3: resolution: {integrity: sha512-fwSOJsbbNzZ/CUFpqFBqYfYNLj1NbMPm8MMCIzHjC83iSJRBEGmDUxU+WP661BaBQImeC2yHwXtz+P/O9o+XEg==} @@ -18590,7 +18588,6 @@ packages: /define-lazy-prop@3.0.0: resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==} engines: {node: '>=12'} - dev: false /define-properties@1.2.1: resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} @@ -18671,7 +18668,6 @@ packages: /depd@1.1.2: resolution: {integrity: sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==} engines: {node: '>= 0.6'} - dev: false /depd@2.0.0: resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} @@ -18734,7 +18730,6 @@ packages: /detect-node@2.1.0: resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==} - dev: false /detect-port-alt@1.1.6: resolution: {integrity: sha512-5tQykt+LqfJFBEYaDITx7S7cR7mJ/zQmLXZ2qt5w04ainYZw6tBf9dBunMjVeVOdYVRUzUOE4HkY5J7+uttb5Q==} @@ -18804,7 +18799,6 @@ packages: engines: {node: '>=6'} dependencies: '@leichtgewicht/ip-codec': 2.0.4 - dev: false /doctrine@2.1.0: resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==} @@ -20919,7 +20913,6 @@ packages: engines: {node: '>=0.8.0'} dependencies: websocket-driver: 0.7.4 - dev: false /fb-watchman@2.0.2: resolution: {integrity: sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==} @@ -21833,7 +21826,6 @@ packages: /handle-thing@2.0.1: resolution: {integrity: sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==} - dev: false /handlebars@4.7.8: resolution: {integrity: sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==} @@ -22082,7 +22074,6 @@ packages: obuf: 1.1.2 readable-stream: 2.3.8 wbuf: 1.7.3 - dev: false /html-encoding-sniffer@3.0.0: resolution: {integrity: sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==} @@ -22183,7 +22174,6 @@ packages: /http-deceiver@1.2.7: resolution: {integrity: sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw==} - dev: false /http-errors@1.6.3: resolution: {integrity: sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==} @@ -22193,7 +22183,6 @@ packages: inherits: 2.0.3 setprototypeof: 1.1.0 statuses: 1.5.0 - dev: false /http-errors@1.8.1: resolution: {integrity: sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==} @@ -22218,7 +22207,6 @@ packages: /http-parser-js@0.5.8: resolution: {integrity: sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q==} - dev: false /http-proxy-agent@4.0.1: resolution: {integrity: sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==} @@ -22263,7 +22251,6 @@ packages: micromatch: 4.0.5 transitivePeerDependencies: - debug - dev: false /http-proxy@1.18.1: resolution: {integrity: sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==} @@ -22575,7 +22562,6 @@ packages: /ipaddr.js@2.1.0: resolution: {integrity: sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ==} engines: {node: '>= 10'} - dev: false /is-absolute-url@3.0.3: resolution: {integrity: sha512-opmNIX7uFnS96NtPmhWQgQx6/NYFgsUXYMllcfzwWKUMwfo8kku1TvE6hkNcH+Q1ts5cMVrsY7j0bxXQDciu9Q==} @@ -22747,7 +22733,6 @@ packages: resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} hasBin: true - dev: false /is-dom@1.1.0: resolution: {integrity: sha512-u82f6mvhYxRPKpw8V1N0W8ce1xXwOrQtgGcxl6UCL5zBmZu3is/18K0rR7uFCnMDuAsS/3W54mGL4vsaFUQlEQ==} @@ -22832,7 +22817,6 @@ packages: hasBin: true dependencies: is-docker: 3.0.0 - dev: false /is-installed-globally@0.4.0: resolution: {integrity: sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==} @@ -22861,7 +22845,6 @@ packages: /is-network-error@1.1.0: resolution: {integrity: sha512-tUdRRAnhT+OtCZR/LxZelH/C7QtjtFrTu5tXCA8pl55eTUElUHT+GPYV8MBMBvea/j+NxQqVt3LbWMRir7Gx9g==} engines: {node: '>=16'} - dev: false /is-npm@5.0.0: resolution: {integrity: sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==} @@ -22908,7 +22891,6 @@ packages: /is-plain-obj@3.0.0: resolution: {integrity: sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==} engines: {node: '>=10'} - dev: false /is-plain-object@2.0.4: resolution: {integrity: sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==} @@ -23075,7 +23057,6 @@ packages: engines: {node: '>=16'} dependencies: is-inside-container: 1.0.0 - dev: false /is-yarn-global@0.3.0: resolution: {integrity: sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==} @@ -24263,7 +24244,6 @@ packages: dependencies: picocolors: 1.0.0 shell-quote: 1.8.1 - dev: false /lazy-universal-dotenv@3.0.1: resolution: {integrity: sha512-prXSYk799h3GY3iOWnC6ZigYzMPjxN2svgjJ9shk7oMadSNX3wXy0B6F32PMJv7qtMnrIbUxoEHzbutvxR2LBQ==} @@ -25124,7 +25104,6 @@ packages: dependencies: dns-packet: 5.6.1 thunky: 1.1.0 - dev: false /multimatch@5.0.0: resolution: {integrity: sha512-ypMKuglUrZUD99Tk2bUQ+xNQj43lPEfAeX2o9cTteAmShXy2VHDJpuwu1o0xqoKCt9jLVAvwyFKdLTPXKAfJyA==} @@ -25269,7 +25248,6 @@ packages: /node-forge@1.3.1: resolution: {integrity: sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==} engines: {node: '>= 6.13.0'} - dev: false /node-gyp@8.1.0: resolution: {integrity: sha512-o2elh1qt7YUp3lkMwY3/l4KF3j/A3fI/Qt4NH+CQQgPJdqGE9y7qnP84cjIWN27Q0jJkrSAhCVDg+wBVNBYdBg==} @@ -25601,7 +25579,6 @@ packages: /obuf@1.1.2: resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==} - dev: false /on-finished@2.3.0: resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==} @@ -25639,7 +25616,6 @@ packages: define-lazy-prop: 3.0.0 is-inside-container: 1.0.0 is-wsl: 3.1.0 - dev: false /open@7.4.2: resolution: {integrity: sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==} @@ -25824,7 +25800,6 @@ packages: '@types/retry': 0.12.2 is-network-error: 1.1.0 retry: 0.13.1 - dev: false /p-settle@4.1.1: resolution: {integrity: sha512-6THGh13mt3gypcNMm0ADqVNCcYa3BK6DWsuJWFCuEKP1rpY+OKGp7gaZwVmLspmic01+fsg/fN57MfvDzZ/PuQ==} @@ -27823,7 +27798,6 @@ packages: /run-applescript@7.0.0: resolution: {integrity: sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==} engines: {node: '>=18'} - dev: false /run-async@2.4.1: resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==} @@ -28251,7 +28225,6 @@ packages: ajv: 8.13.0 ajv-formats: 2.1.1 ajv-keywords: 5.1.0(ajv@8.13.0) - dev: false /schema-utils@4.3.0: resolution: {integrity: sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==} @@ -28268,7 +28241,6 @@ packages: /select-hose@2.0.0: resolution: {integrity: sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==} - dev: false /selfsigned@2.4.1: resolution: {integrity: sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==} @@ -28276,7 +28248,6 @@ packages: dependencies: '@types/node-forge': 1.3.11 node-forge: 1.3.1 - dev: false /semver-compare@1.0.0: resolution: {integrity: sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==} @@ -28412,7 +28383,6 @@ packages: http-errors: 1.6.3 mime-types: 2.1.35 parseurl: 1.3.3 - dev: false /serve-static@1.16.2: resolution: {integrity: sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==} @@ -28490,7 +28460,6 @@ packages: /setprototypeof@1.1.0: resolution: {integrity: sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==} - dev: false /setprototypeof@1.2.0: resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} @@ -28536,7 +28505,6 @@ packages: /shell-quote@1.8.1: resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==} - dev: false /shelljs@0.8.5: resolution: {integrity: sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==} @@ -28695,7 +28663,6 @@ packages: faye-websocket: 0.11.4 uuid: 8.3.2 websocket-driver: 0.7.4 - dev: false /socks-proxy-agent@5.0.1: resolution: {integrity: sha512-vZdmnjb9a2Tz6WEQVIurybSwElwPxMZaIc7PzqbJTrezcKNznv6giT7J7tZDZ1BojVaa1jvO/UiUdhDVB0ACoQ==} @@ -28841,7 +28808,6 @@ packages: wbuf: 1.7.3 transitivePeerDependencies: - supports-color - dev: false /spdy@4.0.2: resolution: {integrity: sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==} @@ -28854,7 +28820,6 @@ packages: spdy-transport: 3.0.0 transitivePeerDependencies: - supports-color - dev: false /split-string@3.1.0: resolution: {integrity: sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==} @@ -28920,7 +28885,6 @@ packages: /statuses@1.5.0: resolution: {integrity: sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==} engines: {node: '>= 0.6'} - dev: false /statuses@2.0.1: resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==} @@ -29594,7 +29558,6 @@ packages: /thunky@1.1.0: resolution: {integrity: sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==} - dev: false /timers-browserify@2.0.12: resolution: {integrity: sha512-9phl76Cqm6FhSX9Xe1ZUAMLtm1BLkKj2Qd5ApyWkXzsMRaA7dgr81kf4wJmQf/hAvg8EEyJxDo3du/0KlhPiKQ==} @@ -30661,7 +30624,6 @@ packages: resolution: {integrity: sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==} dependencies: minimalistic-assert: 1.0.1 - dev: false /wcwidth@1.0.1: resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} @@ -30756,7 +30718,6 @@ packages: range-parser: 1.2.1 schema-utils: 4.2.0 webpack: 5.98.0 - dev: false /webpack-dev-server@4.9.3(@types/webpack@4.41.32)(webpack@4.47.0): resolution: {integrity: sha512-3qp/eoboZG5/6QgiZ3llN8TUzkSpYg1Ko9khWX1h40MIEUNS2mDoIa8aXsPfskER+GbTvs/IJZ1QTBBhhuetSw==} @@ -30864,7 +30825,6 @@ packages: - debug - supports-color - utf-8-validate - dev: false /webpack-filter-warnings-plugin@1.2.1(webpack@4.47.0): resolution: {integrity: sha512-Ez6ytc9IseDMLPo0qCuNNYzgtUl8NovOqjIq4uAU8LTD4uoa1w1KpZyyzFtLTEMZpkkOkLfL9eN+KGYdk1Qtwg==} @@ -30996,12 +30956,10 @@ packages: http-parser-js: 0.5.8 safe-buffer: 5.2.1 websocket-extensions: 0.1.4 - dev: false /websocket-extensions@0.1.4: resolution: {integrity: sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==} engines: {node: '>=0.8.0'} - dev: false /whatwg-encoding@2.0.0: resolution: {integrity: sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==} @@ -31271,7 +31229,6 @@ packages: optional: true utf-8-validate: optional: true - dev: false /xdg-basedir@4.0.0: resolution: {integrity: sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==} diff --git a/heft-plugins/heft-rspack-plugin/README.md b/heft-plugins/heft-rspack-plugin/README.md index 1beae62cbf5..3dcab2dbe8f 100644 --- a/heft-plugins/heft-rspack-plugin/README.md +++ b/heft-plugins/heft-rspack-plugin/README.md @@ -1,6 +1,6 @@ # @rushstack/heft-rspack-plugin -This is a Heft plugin for using RSPack during the "bundle" stage. +This is a Heft plugin for using Rspack during the "bundle" stage. ## Links diff --git a/heft-plugins/heft-rspack-plugin/config/jest.config.json b/heft-plugins/heft-rspack-plugin/config/jest.config.json index 4bb17bde3ee..d1749681d90 100644 --- a/heft-plugins/heft-rspack-plugin/config/jest.config.json +++ b/heft-plugins/heft-rspack-plugin/config/jest.config.json @@ -1,3 +1,3 @@ { - "extends": "@rushstack/heft-node-rig/profiles/default/config/jest.config.json" + "extends": "local-node-rig/profiles/default/config/jest.config.json" } diff --git a/heft-plugins/heft-rspack-plugin/config/rig.json b/heft-plugins/heft-rspack-plugin/config/rig.json index 6ac88a96368..165ffb001f5 100644 --- a/heft-plugins/heft-rspack-plugin/config/rig.json +++ b/heft-plugins/heft-rspack-plugin/config/rig.json @@ -3,5 +3,5 @@ // Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", - "rigPackageName": "@rushstack/heft-node-rig" + "rigPackageName": "local-node-rig" } diff --git a/heft-plugins/heft-rspack-plugin/heft-plugin.json b/heft-plugins/heft-rspack-plugin/heft-plugin.json new file mode 100644 index 00000000000..1a672ffd7fe --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/heft-plugin.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft-plugin.schema.json", + + "taskPlugins": [ + { + "pluginName": "rspack-plugin", + "entryPoint": "./lib/RspackPlugin", + "optionsSchema": "./lib/schemas/heft-rspack-plugin.schema.json", + + "parameterScope": "rspack", + "parameters": [ + { + "longName": "--serve", + "parameterKind": "flag", + "description": "Start a local web server for testing purposes using webpack-dev-server. This parameter is only available when running in watch mode." + } + ] + } + ] +} diff --git a/heft-plugins/heft-rspack-plugin/package.json b/heft-plugins/heft-rspack-plugin/package.json index acbb9eda6e0..223bbab0d84 100644 --- a/heft-plugins/heft-rspack-plugin/package.json +++ b/heft-plugins/heft-rspack-plugin/package.json @@ -1,7 +1,7 @@ { "name": "@rushstack/heft-rspack-plugin", "version": "0.0.0", - "description": "Heft plugin for RSPack", + "description": "Heft plugin for Rspack", "repository": { "type": "git", "url": "https://github.com/microsoft/rushstack.git", @@ -22,7 +22,11 @@ "@rspack/core": "^0.1.1" }, "dependencies": { - "@rushstack/node-core-library": "workspace:*" + "@rushstack/node-core-library": "workspace:*", + "@types/tapable": "1.0.6", + "tapable": "1.1.3", + "@rushstack/debug-certificate-manager": "workspace:*", + "webpack-dev-server": "^5.1.0" }, "devDependencies": { "@rushstack/eslint-config": "workspace:*", diff --git a/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts b/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts index a2254847615..3bf8c649200 100644 --- a/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts +++ b/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts @@ -2,124 +2,184 @@ // See LICENSE in the project root for license information. import * as path from 'path'; -import { type FolderItem, FileSystem } from '@rushstack/node-core-library'; -import type * as rspack from '@rspack/core'; -import type { IBuildStageProperties, ScopedLogger } from '@rushstack/heft'; +import type * as TRspack from '@rspack/core'; +import { FileSystem } from '@rushstack/node-core-library'; +import type { IHeftTaskSession, HeftConfiguration } from '@rushstack/heft'; -import { IRspackConfiguration } from './shared'; +import type { IRspackPluginOptions } from './RspackPlugin'; +import { + PLUGIN_NAME, + STAGE_LOAD_LOCAL_CONFIG, + type IRspackConfiguration, + type IRspackConfigurationFnEnvironment, + type IRspackPluginAccessorHooks +} from './shared'; -interface IRspackConfigFunctionEnv { - prod: boolean; - production: boolean; -} type IRspackConfigJsExport = - | rspack.Configuration - | rspack.Configuration[] - | Promise - | Promise - | ((env: IRspackConfigFunctionEnv) => rspack.Configuration | rspack.Configuration[]) - | ((env: IRspackConfigFunctionEnv) => Promise); + | TRspack.Configuration + | TRspack.Configuration[] + | Promise + | Promise + | ((env: IRspackConfigurationFnEnvironment) => TRspack.Configuration | TRspack.Configuration[]) + | ((env: IRspackConfigurationFnEnvironment) => Promise); type IRspackConfigJs = IRspackConfigJsExport | { default: IRspackConfigJsExport }; -interface IRspackConfigFileNames { - dev: string | undefined; - prod: string | undefined; +/** + * @internal + */ +export interface ILoadRspackConfigurationOptions { + taskSession: IHeftTaskSession; + heftConfiguration: HeftConfiguration; + serveMode: boolean; + loadRspackAsyncFn: () => Promise; + hooks: Pick; + + _tryLoadConfigFileAsync?: typeof tryLoadRspackConfigurationFileAsync; } -export class RspackConfigurationLoader { - public static async tryLoadRspackConfigAsync( - logger: ScopedLogger, - buildFolder: string, - buildProperties: IBuildStageProperties - ): Promise { - const rspackConfigFiles: IRspackConfigFileNames | undefined = await findRspackConfigAsync(buildFolder); - const rspackDevConfigFilename: string | undefined = rspackConfigFiles.dev; - const rspackConfigFilename: string | undefined = rspackConfigFiles.prod; +const DEFAULT_RSPACK_CONFIG_PATH: './rspack.config.js' = './rspack.config.js'; +const DEFAULT_RSPACK_DEV_CONFIG_PATH: './rspack.dev.config.js' = './rspack.dev.config.js'; - let rspackConfigJs: IRspackConfigJs | undefined; +/** + * @internal + */ +export async function tryLoadRspackConfigurationAsync( + options: ILoadRspackConfigurationOptions, + pluginOptions: IRspackPluginOptions +): Promise { + const { taskSession, hooks, _tryLoadConfigFileAsync = tryLoadRspackConfigurationFileAsync } = options; + const { logger } = taskSession; + const { terminal } = logger; - try { - if (buildProperties.serveMode && rspackDevConfigFilename) { - logger.terminal.writeVerboseLine( - `Attempting to load rspack configuration from "${rspackDevConfigFilename}".` - ); - rspackConfigJs = RspackConfigurationLoader._tryLoadRspackConfiguration( - buildFolder, - rspackDevConfigFilename - ); - } + // Apply default behavior. Due to the state of `this._rspackConfiguration`, this code + // will execute exactly once. + hooks.onLoadConfiguration.tapPromise( + { + name: PLUGIN_NAME, + stage: STAGE_LOAD_LOCAL_CONFIG + }, + async () => { + terminal.writeVerboseLine(`Attempting to load Rspack configuration from local file`); + const rspackConfiguration: IRspackConfiguration | undefined = await _tryLoadConfigFileAsync( + options, + pluginOptions + ); - if (!rspackConfigJs && rspackConfigFilename) { - logger.terminal.writeVerboseLine( - `Attempting to load rspack configuration from "${rspackConfigFilename}".` - ); - rspackConfigJs = RspackConfigurationLoader._tryLoadRspackConfiguration( - buildFolder, - rspackConfigFilename - ); + if (rspackConfiguration) { + terminal.writeVerboseLine(`Loaded Rspack configuration from local file.`); } - } catch (error) { - logger.emitError(error as Error); + + return rspackConfiguration; } + ); - if (rspackConfigJs) { - const rspackConfig: IRspackConfigJsExport = - (rspackConfigJs as { default: IRspackConfigJsExport }).default || rspackConfigJs; + // Obtain the Rspack configuration by calling into the hook. + // The local configuration is loaded at STAGE_LOAD_LOCAL_CONFIG + terminal.writeVerboseLine('Attempting to load Rspack configuration'); + let rspackConfiguration: IRspackConfiguration | false | undefined = + await hooks.onLoadConfiguration.promise(); - if (typeof rspackConfig === 'function') { - return rspackConfig({ prod: buildProperties.production, production: buildProperties.production }); - } else { - return rspackConfig; - } - } else { - return undefined; + if (rspackConfiguration === false) { + terminal.writeLine('Rspack disabled by external plugin'); + rspackConfiguration = undefined; + } else if ( + rspackConfiguration === undefined || + (Array.isArray(rspackConfiguration) && rspackConfiguration.length === 0) + ) { + terminal.writeLine('No Rspack configuration found'); + rspackConfiguration = undefined; + } else { + if (hooks.onConfigure.isUsed()) { + // Allow for plugins to customise the configuration + await hooks.onConfigure.promise(rspackConfiguration); } - } - - private static _tryLoadRspackConfiguration( - buildFolder: string, - configurationFilename: string - ): IRspackConfigJs | undefined { - const fullRspackConfigPath: string = path.join(buildFolder, configurationFilename); - if (FileSystem.exists(fullRspackConfigPath)) { - try { - return require(fullRspackConfigPath); - } catch (e) { - throw new Error(`Error loading rspack configuration at "${fullRspackConfigPath}": ${e}`); - } - } else { - return undefined; + if (hooks.onAfterConfigure.isUsed()) { + // Provide the finalized configuration + await hooks.onAfterConfigure.promise(rspackConfiguration); } } + return rspackConfiguration; } -async function findRspackConfigAsync(buildFolder: string): Promise { +/** + * @internal + */ +export async function tryLoadRspackConfigurationFileAsync( + options: ILoadRspackConfigurationOptions, + pluginOptions: IRspackPluginOptions +): Promise { + const { taskSession, heftConfiguration, loadRspackAsyncFn, serveMode } = options; + const { + logger, + parameters: { production } + } = taskSession; + const { terminal } = logger; + const { configurationPath, devConfigurationPath } = pluginOptions; + let rspackConfigJs: IRspackConfigJs | undefined; + try { - const folderItems: FolderItem[] = await FileSystem.readFolderItemsAsync(buildFolder); - const dev: string[] = []; - const prod: string[] = []; - - for (const folderItem of folderItems) { - if (folderItem.isFile()) { - if (folderItem.name.match(/^rspack.dev.config\.(cjs|js|mjs)$/)) { - dev.push(folderItem.name); - } else if (folderItem.name.match(/^rspack.config\.(cjs|js|mjs)$/)) { - prod.push(folderItem.name); - } - } + const buildFolderPath: string = heftConfiguration.buildFolderPath; + if (serveMode) { + const devConfigPath: string = path.resolve( + buildFolderPath, + devConfigurationPath || DEFAULT_RSPACK_DEV_CONFIG_PATH + ); + terminal.writeVerboseLine(`Attempting to load rspack configuration from "${devConfigPath}".`); + rspackConfigJs = await _tryLoadRspackConfigurationFileInnerAsync(devConfigPath); } - if (dev.length > 1) { - throw new Error(`Error: Found more than one dev rspack configuration file.`); - } else if (prod.length > 1) { - throw new Error(`Error: Found more than one non-dev rspack configuration file.`); + if (!rspackConfigJs) { + const configPath: string = path.resolve( + buildFolderPath, + configurationPath || DEFAULT_RSPACK_CONFIG_PATH + ); + terminal.writeVerboseLine(`Attempting to load rspack configuration from "${configPath}".`); + rspackConfigJs = await _tryLoadRspackConfigurationFileInnerAsync(configPath); } + } catch (error) { + logger.emitError(error as Error); + } + + if (rspackConfigJs) { + const rspackConfig: IRspackConfigJsExport = + (rspackConfigJs as { default: IRspackConfigJsExport }).default || rspackConfigJs; - return { - dev: dev[0], - prod: prod[0] - }; - } catch (e) { - throw new Error(`Error finding rspack configuration: ${e}`); + if (typeof rspackConfig === 'function') { + // Defer loading of rspack until we know for sure that we will need it + return rspackConfig({ + prod: production, + production, + taskSession, + heftConfiguration, + rspack: await loadRspackAsyncFn() + }); + } else { + return rspackConfig; + } + } else { + return undefined; + } +} + +/** + * @internal + */ +export async function _tryLoadRspackConfigurationFileInnerAsync( + configurationPath: string +): Promise { + const configExists: boolean = await FileSystem.existsAsync(configurationPath); + if (configExists) { + try { + return await import(configurationPath); + } catch (e) { + const error: NodeJS.ErrnoException = e as NodeJS.ErrnoException; + if (error.code === 'ERR_MODULE_NOT_FOUND') { + // No configuration found, return undefined. + return undefined; + } + throw new Error(`Error loading Rspack configuration at "${configurationPath}": ${e}`); + } + } else { + return undefined; } } diff --git a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts index 59d4cbcce33..6d9d00b7661 100644 --- a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts +++ b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts @@ -1,260 +1,413 @@ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. // See LICENSE in the project root for license information. -import type { - Compiler as RspackCompiler, - MultiCompiler as RspackMultiCompiler, - Stats as RspackStats, - StatsCompilation as RspackStatsCompilation - // DevServer as RspackDevServer, -} from '@rspack/core'; -import { LegacyAdapters, Import, IPackageJson, PackageJsonLookup } from '@rushstack/node-core-library'; +import type { AddressInfo } from 'net'; + +import type * as TRspack from '@rspack/core'; +import type TWebpackDevServer from 'webpack-dev-server'; +import { AsyncParallelHook, AsyncSeriesBailHook, AsyncSeriesHook, AsyncSeriesWaterfallHook } from 'tapable'; + +import { CertificateManager, type ICertificate } from '@rushstack/debug-certificate-manager'; +import { FileError, InternalError, LegacyAdapters } from '@rushstack/node-core-library'; import type { HeftConfiguration, - HeftSession, - IBuildStageContext, - IBuildStageProperties, - IBundleSubstage, - IHeftPlugin, - ScopedLogger + IHeftTaskSession, + IHeftTaskPlugin, + IHeftTaskRunHookOptions, + IScopedLogger, + IHeftTaskRunIncrementalHookOptions } from '@rushstack/heft'; -import type { - IRspackConfiguration, - IRspackBundleSubstageProperties, - IRspackBuildStageProperties + +import { + type IRspackConfiguration, + type IRspackPluginAccessor, + PLUGIN_NAME, + type IRspackPluginAccessorHooks } from './shared'; -import { RspackConfigurationLoader } from './RspackConfigurationLoader'; +import { tryLoadRspackConfigurationAsync } from './RspackConfigurationLoader'; -const PLUGIN_NAME: string = 'RspackPlugin'; +export interface IRspackPluginOptions { + devConfigurationPath?: string | undefined; + configurationPath?: string | undefined; +} +const SERVE_PARAMETER_LONG_NAME: '--serve' = '--serve'; +const RSPACK_PACKAGE_NAME: '@rspack/core' = '@rspack/core'; +const WEBPACK_DEV_SERVER_PACKAGE_NAME: 'webpack-dev-server' = 'webpack-dev-server'; +const WEBPACK_DEV_SERVER_ENV_VAR_NAME: 'WEBPACK_DEV_SERVER' = 'WEBPACK_DEV_SERVER'; +const WEBPACK_DEV_MIDDLEWARE_PACKAGE_NAME: 'webpack-dev-middleware' = 'webpack-dev-middleware'; /** * @internal */ -export class RspackPlugin implements IHeftPlugin { - public readonly pluginName: string = PLUGIN_NAME; +export default class RspackPlugin implements IHeftTaskPlugin { + private _accessor: IRspackPluginAccessor | undefined; + private _isServeMode: boolean = false; + private _rspack: typeof TRspack | undefined; + private _rspackCompiler: TRspack.Compiler | TRspack.MultiCompiler | undefined; + private _rspackConfiguration: IRspackConfiguration | undefined | false = false; + private _rspackCompilationDonePromise: Promise | undefined; + private _rspackCompilationDonePromiseResolveFn: (() => void) | undefined; - private static _rspackVersion: string | undefined; - private static _rspack: typeof import('@rspack/core') | undefined; + private _warnings: Error[] = []; + private _errors: Error[] = []; - private static async _ensureRspackAsync(): Promise { - if (!RspackPlugin._rspack) { - // eslint-disable-next-line require-atomic-updates - RspackPlugin._rspack = await import('@rspack/core'); + public get accessor(): IRspackPluginAccessor { + if (!this._accessor) { + this._accessor = { + hooks: _createAccessorHooks(), + parameters: { + isServeMode: this._isServeMode + } + }; + } + return this._accessor; + } + + public apply( + taskSession: IHeftTaskSession, + heftConfiguration: HeftConfiguration, + options: IRspackPluginOptions = {} + ): void { + this._isServeMode = taskSession.parameters.getFlagParameter(SERVE_PARAMETER_LONG_NAME).value; + if (this._isServeMode && !taskSession.parameters.watch) { + throw new Error( + `The ${JSON.stringify( + SERVE_PARAMETER_LONG_NAME + )} parameter is only available when running in watch mode.` + + ` Try replacing "${taskSession.parsedCommandLine?.unaliasedCommandName}" with` + + ` "${taskSession.parsedCommandLine?.unaliasedCommandName}-watch" in your Heft command line.` + ); } - return RspackPlugin._rspack; + taskSession.hooks.run.tapPromise(PLUGIN_NAME, async (runOptions: IHeftTaskRunHookOptions) => { + await this._runRspackAsync(taskSession, heftConfiguration, options); + }); + + taskSession.hooks.runIncremental.tapPromise( + PLUGIN_NAME, + async (runOptions: IHeftTaskRunIncrementalHookOptions) => { + await this._runRspackWatchAsync(taskSession, heftConfiguration, options, runOptions.requestRun); + } + ); } - private static _getRspackVersion(): string { - if (!RspackPlugin._rspackVersion) { - const rspackCorePackageJsonPath: string = Import.resolveModule({ - modulePath: '@rspack/core/package.json', - baseFolderPath: __dirname - }); - const rspackCorePackageJson: IPackageJson = - PackageJsonLookup.instance.loadPackageJson(rspackCorePackageJsonPath); + private async _getRspackConfigurationAsync( + taskSession: IHeftTaskSession, + heftConfiguration: HeftConfiguration, + options: IRspackPluginOptions, + requestRun?: () => void + ): Promise { + if (this._rspackConfiguration === false) { + const rspackConfiguration: IRspackConfiguration | undefined = await tryLoadRspackConfigurationAsync( + { + taskSession, + heftConfiguration, + hooks: this.accessor.hooks, + serveMode: this._isServeMode, + loadRspackAsyncFn: this._loadRspackAsync.bind(this) + }, + options + ); - RspackPlugin._rspackVersion = rspackCorePackageJson.version; + this._rspackConfiguration = rspackConfiguration; } - return RspackPlugin._rspackVersion; + return this._rspackConfiguration; } - public apply(heftSession: HeftSession, heftConfiguration: HeftConfiguration): void { - heftSession.hooks.build.tap(PLUGIN_NAME, (build: IBuildStageContext) => { - build.hooks.bundle.tap(PLUGIN_NAME, (bundle: IBundleSubstage) => { - bundle.hooks.configureWebpack.tapPromise(PLUGIN_NAME, async (existingConfiguration: unknown) => { - const logger: ScopedLogger = heftSession.requestScopedLogger('configure-rspack'); - if (existingConfiguration) { - logger.terminal.writeVerboseLine( - 'Skipping loading rspack config file because the rspack config has already been set.' - ); - return existingConfiguration; - } else { - return await RspackConfigurationLoader.tryLoadRspackConfigAsync( - logger, - heftConfiguration.buildFolder, - build.properties - ); - } - }); + private async _loadRspackAsync(): Promise { + if (!this._rspack) { + // Allow this to fail if Rspack is not installed + this._rspack = await import(RSPACK_PACKAGE_NAME); + } + return this._rspack!; + } - bundle.hooks.run.tapPromise(PLUGIN_NAME, async () => { - await this._runRspackAsync( - heftSession, - heftConfiguration, - bundle.properties as IRspackBundleSubstageProperties, - build.properties, - heftConfiguration.terminalProvider.supportsColor - ); - }); - }); - }); + private async _getRspackCompilerAsync( + taskSession: IHeftTaskSession, + rspackConfiguration: IRspackConfiguration + ): Promise { + if (!this._rspackCompiler) { + const rspack: typeof TRspack = await this._loadRspackAsync(); + taskSession.logger.terminal.writeLine(`Using Rspack version ${rspack.version}`); + this._rspackCompiler = Array.isArray(rspackConfiguration) + ? rspack.default(rspackConfiguration) /* (rspack.Compilation[]) => MultiCompiler */ + : rspack.default(rspackConfiguration); /* (rspack.Compilation) => Compiler */ + } + return this._rspackCompiler; } private async _runRspackAsync( - heftSession: HeftSession, + taskSession: IHeftTaskSession, heftConfiguration: HeftConfiguration, - bundleSubstageProperties: IRspackBundleSubstageProperties, - buildProperties: IBuildStageProperties, - supportsColor: boolean + options: IRspackPluginOptions ): Promise { - const rspackConfiguration: IRspackConfiguration | undefined | null = - bundleSubstageProperties.rspackConfiguration; + this._validateEnvironmentVariable(taskSession); + if (taskSession.parameters.watch || this._isServeMode) { + // Should never happen, but just in case + throw new InternalError('Cannot run Rspack in compilation mode when watch mode is enabled'); + } + + // Load the config and compiler, and return if there is no config found + const rspackConfiguration: IRspackConfiguration | undefined = await this._getRspackConfigurationAsync( + taskSession, + heftConfiguration, + options + ); if (!rspackConfiguration) { return; } + const compiler: TRspack.Compiler | TRspack.MultiCompiler = await this._getRspackCompilerAsync( + taskSession, + rspackConfiguration + ); + taskSession.logger.terminal.writeLine('Running Rspack compilation'); - const logger: ScopedLogger = heftSession.requestScopedLogger('rspack'); + // Run the rspack compiler + let stats: TRspack.Stats | TRspack.MultiStats | undefined; + try { + stats = await LegacyAdapters.convertCallbackToPromise( + (compiler as TRspack.Compiler).run.bind(compiler) + ); + await LegacyAdapters.convertCallbackToPromise(compiler.close.bind(compiler)); + } catch (e) { + taskSession.logger.emitError(e as Error); + } - // TODO: Do some version checking + // Emit the errors from the stats object, if present + if (stats) { + this._recordErrors(stats, heftConfiguration.buildFolderPath); + this._emitErrors(taskSession.logger); + if (this.accessor.hooks.onEmitStats.isUsed()) { + await this.accessor.hooks.onEmitStats.promise(stats); + } + } + } - logger.terminal.writeLine(`Using Rspack version ${RspackPlugin._getRspackVersion()}`); + private async _runRspackWatchAsync( + taskSession: IHeftTaskSession, + heftConfiguration: HeftConfiguration, + options: IRspackPluginOptions, + requestRun: () => void + ): Promise { + // Save a handle to the original promise, since the this-scoped promise will be replaced whenever + // the compilation completes. + let rspackCompilationDonePromise: Promise | undefined = this._rspackCompilationDonePromise; - let compiler: RspackCompiler | RspackMultiCompiler; - const { rspack } = await RspackPlugin._ensureRspackAsync(); - if (Array.isArray(rspackConfiguration)) { - if (rspackConfiguration.length === 0) { - logger.terminal.writeLine('The rspack configuration is an empty array - nothing to do.'); + if (!this._rspackCompiler) { + this._validateEnvironmentVariable(taskSession); + if (!taskSession.parameters.watch) { + // Should never happen, but just in case + throw new InternalError('Cannot run Rspack in watch mode when compilation mode is enabled'); + } + + // Load the config and compiler, and return if there is no config found + const rspackConfiguration: IRspackConfiguration | undefined = await this._getRspackConfigurationAsync( + taskSession, + heftConfiguration, + options, + requestRun + ); + if (!rspackConfiguration) { return; - } else { - compiler = rspack(rspackConfiguration); } - } else { - compiler = rspack(rspackConfiguration); - } - if (buildProperties.serveMode) { - // TODO: Get dev server configuration working - // const defaultDevServerOptions: RspackDevServer = { - // host: 'localhost', - // devMiddleware: { - // publicPath: '/', - // stats: { - // cached: false, - // cachedAssets: false, - // colors: supportsColor - // } - // }, - // client: { - // logging: 'info', - // webSocketURL: { - // port: 8080 - // } - // }, - // port: 8080 - // }; - // let options: RspackDevServer; - // if (Array.isArray(rspackConfiguration)) { - // const devServerOptions: RspackDevServer[] = rspackConfiguration - // .map((configuration) => configuration.devServer) - // .filter((devServer): devServer is RspackDevServer => !!devServer); - // if (devServerOptions.length > 1) { - // logger.emitWarning( - // new Error(`Detected multiple webpack devServer configurations, using the first one.`) - // ); - // } - // if (devServerOptions.length > 0) { - // options = { ...defaultDevServerOptions, ...devServerOptions[0] }; - // } else { - // options = defaultDevServerOptions; - // } - // } else { - // options = { ...defaultDevServerOptions, ...rspackConfiguration.devServer }; - // } - // // Register a plugin to callback after webpack is done with the first compilation - // // so we can move on to post-build - // let firstCompilationDoneCallback: (() => void) | undefined; - // const originalBeforeCallback: typeof options.setupMiddlewares | undefined = options.setupMiddlewares; - // options.setupMiddlewares = (middlewares, devServer) => { - // compiler.hooks.done.tap('heft-webpack-plugin', () => { - // if (firstCompilationDoneCallback) { - // firstCompilationDoneCallback(); - // firstCompilationDoneCallback = undefined; - // } - // }); - // if (originalBeforeCallback) { - // return originalBeforeCallback(middlewares, devServer); - // } - // return middlewares; - // }; - // // The webpack-dev-server package has a design flaw, where merely loading its package will set the - // // WEBPACK_DEV_SERVER environment variable -- even if no APIs are accessed. This environment variable - // // causes incorrect behavior if Heft is not running in serve mode. Thus, we need to be careful to call require() - // // only if Heft is in serve mode. - // const WebpackDevServer: typeof TWebpackDevServer = require(WEBPACK_DEV_SERVER_PACKAGE_NAME); - // // TODO: the WebpackDevServer accepts a third parameter for a logger. We should make - // // use of that to make logging cleaner - // const webpackDevServer: TWebpackDevServer = new WebpackDevServer(options, compiler); - // await new Promise((resolve: () => void, reject: (error: Error) => void) => { - // firstCompilationDoneCallback = resolve; - // // Wrap in promise.resolve due to small issue in the type declaration, return type should be - // // webpackDevServer.start(): Promise; - // Promise.resolve(webpackDevServer.start()).catch(reject); - // }); - } else { - // TODO: Ensure check for too-early loading of webpack-dev-server - // if (process.env[WEBPACK_DEV_SERVER_ENV_VAR_NAME]) { - // logger.emitWarning( - // new Error( - // `The "${WEBPACK_DEV_SERVER_ENV_VAR_NAME}" environment variable is set, ` + - // 'which will cause problems when webpack is not running in serve mode. ' + - // `(Did a dependency inadvertently load the "${WEBPACK_DEV_SERVER_PACKAGE_NAME}" package?)` - // ) - // ); - // } - - let stats: RspackStats | undefined; - if (buildProperties.watchMode) { - try { - stats = await LegacyAdapters.convertCallbackToPromise( - (compiler as RspackCompiler).watch.bind(compiler), - {} - ); - } catch (e) { - logger.emitError(e as Error); + // Get the compiler which will be used for both serve and watch mode + const compiler: TRspack.Compiler | TRspack.MultiCompiler = await this._getRspackCompilerAsync( + taskSession, + rspackConfiguration + ); + + // Set up the hook to detect when the watcher completes the watcher compilation. We will also log out + // errors from the compilation if present from the output stats object. + this._rspackCompilationDonePromise = new Promise((resolve: () => void) => { + this._rspackCompilationDonePromiseResolveFn = resolve; + }); + rspackCompilationDonePromise = this._rspackCompilationDonePromise; + compiler.hooks.done.tap(PLUGIN_NAME, (stats?: TRspack.Stats | TRspack.MultiStats) => { + this._rspackCompilationDonePromiseResolveFn!(); + this._rspackCompilationDonePromise = new Promise((resolve: () => void) => { + this._rspackCompilationDonePromiseResolveFn = resolve; + }); + + if (stats) { + this._recordErrors(stats, heftConfiguration.buildFolderPath); } - } else { - try { - stats = await LegacyAdapters.convertCallbackToPromise( - (compiler as RspackCompiler).run.bind(compiler) + }); + + // Determine how we will run the compiler. When serving, we will run the compiler + // via the webpack-dev-server. Otherwise, we will run the compiler directly. + if (this._isServeMode) { + const defaultDevServerOptions: TWebpackDevServer.Configuration = { + host: 'localhost', + devMiddleware: { + publicPath: '/', + stats: { + cached: false, + cachedAssets: false, + colors: heftConfiguration.terminalProvider.supportsColor + } + }, + client: { + logging: 'info', + webSocketURL: { + port: 8080 + } + }, + port: 8080, + onListening: (server: TWebpackDevServer) => { + const addressInfo: AddressInfo | string | undefined = server.server?.address() as AddressInfo; + if (addressInfo) { + const address: string = + typeof addressInfo === 'string' ? addressInfo : `${addressInfo.address}:${addressInfo.port}`; + taskSession.logger.terminal.writeLine(`Started Webpack Dev Server at https://${address}`); + } + } + }; + + // Obtain the devServerOptions from the webpack configuration, and combine with the default options + let devServerOptions: TWebpackDevServer.Configuration; + if (Array.isArray(rspackConfiguration)) { + const filteredDevServerOptions: TWebpackDevServer.Configuration[] = rspackConfiguration + .map((configuration) => configuration.devServer) + .filter((devServer): devServer is TWebpackDevServer.Configuration => !!devServer); + if (filteredDevServerOptions.length > 1) { + taskSession.logger.emitWarning( + new Error(`Detected multiple rspack devServer configurations, using the first one.`) + ); + } + devServerOptions = { ...defaultDevServerOptions, ...filteredDevServerOptions[0] }; + } else { + devServerOptions = { ...defaultDevServerOptions, ...rspackConfiguration.devServer }; + } + + // Add the certificate and key to the devServerOptions if these fields don't already have values + if (!devServerOptions.server) { + const certificateManager: CertificateManager = new CertificateManager(); + const certificate: ICertificate = await certificateManager.ensureCertificateAsync( + true, + taskSession.logger.terminal ); - await new Promise((resolve, reject) => { - // The close() function's callback does not return an error. - // TODO: Ensure that it can't error - compiler.close(resolve); - }); - } catch (e) { - logger.emitError(e as Error); + + // Update the web socket URL to use the hostname provided by the certificate + const clientConfiguration: TWebpackDevServer.Configuration['client'] = devServerOptions.client; + const hostname: string | undefined = certificate.subjectAltNames?.[0]; + if (hostname && typeof clientConfiguration === 'object') { + const { webSocketURL } = clientConfiguration; + if (typeof webSocketURL === 'object') { + clientConfiguration.webSocketURL = { + ...webSocketURL, + hostname + }; + } + } + + devServerOptions = { + ...devServerOptions, + server: { + type: 'https', + options: { + minVersion: 'TLSv1.3', + key: certificate.pemKey, + cert: certificate.pemCertificate, + ca: certificate.pemCaCertificate + } + } + }; } - } - if (stats) { - // eslint-disable-next-line require-atomic-updates - (buildProperties as IRspackBuildStageProperties).rspackStats = stats; + // Since the webpack-dev-server does not return infrastructure errors via a callback like + // compiler.watch(...), we will need to intercept them and log them ourselves. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + compiler.hooks.infrastructureLog.tap( + PLUGIN_NAME, + (name: string, type: string, args: unknown[] | undefined) => { + if (name === WEBPACK_DEV_MIDDLEWARE_PACKAGE_NAME && type === 'error') { + const error: Error | undefined = args?.[0] as Error | undefined; + if (error) { + taskSession.logger.emitError(error); + } + } + return true; + } + ); + + // The webpack-dev-server package has a design flaw, where merely loading its package will set the + // WEBPACK_DEV_SERVER environment variable -- even if no APIs are accessed. This environment variable + // causes incorrect behavior if Heft is not running in serve mode. Thus, we need to be careful to call + // require() only if Heft is in serve mode. + taskSession.logger.terminal.writeLine('Starting webpack-dev-server'); + const WebpackDevServer: typeof TWebpackDevServer = (await import(WEBPACK_DEV_SERVER_PACKAGE_NAME)) + .default; + const webpackDevServer: TWebpackDevServer = new WebpackDevServer(devServerOptions, compiler); + await webpackDevServer.start(); + } else { + // Create the watcher. Compilation will start immediately after invoking watch(). + taskSession.logger.terminal.writeLine('Starting Rspack watcher'); - this._emitErrors(logger, heftConfiguration.buildFolder, stats); + const { onGetWatchOptions } = this.accessor.hooks; + + const watchOptions: Parameters[0] = onGetWatchOptions.isUsed() + ? await onGetWatchOptions.promise({}, rspackConfiguration) + : {}; + + compiler.watch(watchOptions, (error?: Error | null) => { + if (error) { + taskSession.logger.emitError(error); + } + }); } } + + // Resume the compilation, wait for the compilation to complete, then suspend the watchers until the + // next iteration. Even if there are no changes, the promise should resolve since resuming from a + // suspended state invalidates the state of the watcher. + await rspackCompilationDonePromise; + + this._emitErrors(taskSession.logger); } - private _emitErrors(logger: ScopedLogger, buildFolder: string, stats: RspackStats): void { - if (stats.hasErrors() || stats.hasWarnings()) { - const serializedStats: RspackStatsCompilation[] = [stats.toJson('errors-warnings')]; + private _validateEnvironmentVariable(taskSession: IHeftTaskSession): void { + if (!this._isServeMode && process.env[WEBPACK_DEV_SERVER_ENV_VAR_NAME]) { + taskSession.logger.emitWarning( + new Error( + `The "${WEBPACK_DEV_SERVER_ENV_VAR_NAME}" environment variable is set, ` + + 'which will cause problems when rspack is not running in serve mode. ' + + `(Did a dependency inadvertently load the "${WEBPACK_DEV_SERVER_PACKAGE_NAME}" package?)` + ) + ); + } + } - const errors: Error[] = []; - const warnings: Error[] = []; + private _emitErrors(logger: IScopedLogger): void { + for (const warning of this._warnings) { + logger.emitWarning(warning); + } + for (const error of this._errors) { + logger.emitError(error); + } + } + + private _recordErrors(stats: TRspack.Stats | TRspack.MultiStats, buildFolderPath: string): void { + const errors: Error[] = this._errors; + const warnings: Error[] = this._warnings; + + errors.length = 0; + warnings.length = 0; + + if (stats.hasErrors() || stats.hasWarnings()) { + const serializedStats: TRspack.StatsCompilation[] = [stats.toJson('errors-warnings')]; for (const compilationStats of serializedStats) { if (compilationStats.warnings) { for (const warning of compilationStats.warnings) { - warnings.push(this._normalizeError(buildFolder, warning)); + warnings.push(this._normalizeError(buildFolderPath, warning)); } } if (compilationStats.errors) { for (const error of compilationStats.errors) { - errors.push(this._normalizeError(buildFolder, error)); + errors.push(this._normalizeError(buildFolderPath, error)); } } @@ -264,38 +417,55 @@ export class RspackPlugin implements IHeftPlugin { } } } - - for (const warning of warnings) { - logger.emitWarning(warning); - } - - for (const error of errors) { - logger.emitError(error); - } } } - private _normalizeError(buildFolder: string, error: unknown): Error { + private _normalizeError(buildFolderPath: string, error: TRspack.StatsError): Error { if (error instanceof Error) { return error; + } else if (error.moduleIdentifier) { + let lineNumber: number | undefined; + let columnNumber: number | undefined; + if (error.loc) { + // Format of ":-" + // https://webpack.js.org/api/stats/#errors-and-warnings + const [lineNumberRaw, columnRangeRaw] = error.loc.split(':'); + const [startColumnRaw] = columnRangeRaw.split('-'); + if (lineNumberRaw) { + lineNumber = parseInt(lineNumberRaw, 10); + if (isNaN(lineNumber)) { + lineNumber = undefined; + } + } + if (startColumnRaw) { + columnNumber = parseInt(startColumnRaw, 10); + if (isNaN(columnNumber)) { + columnNumber = undefined; + } + } + } + + return new FileError(error.message, { + absolutePath: error.moduleIdentifier, + projectFolder: buildFolderPath, + line: lineNumber, + column: columnNumber + }); } else { - // TODO: Handle better formatting of errors - return error as Error; - // let moduleName: string | undefined = error.moduleName; - // if (!moduleName && error.moduleIdentifier) { - // moduleName = Path.convertToSlashes(nodePath.relative(buildFolder, error.moduleIdentifier)); - // } - - // let formattedError: string; - // if (error.loc && moduleName) { - // formattedError = `${moduleName}:${error.loc} - ${error.message}`; - // } else if (moduleName) { - // formattedError = `${moduleName} - ${error.message}`; - // } else { - // formattedError = error.message; - // } - - // return new Error(formattedError); + return new Error(error.message); } } } + +/** + * @internal + */ +export function _createAccessorHooks(): IRspackPluginAccessorHooks { + return { + onLoadConfiguration: new AsyncSeriesBailHook(), + onConfigure: new AsyncSeriesHook(['rspackConfiguration']), + onAfterConfigure: new AsyncParallelHook(['rspackConfiguration']), + onEmitStats: new AsyncParallelHook(['rspackStats']), + onGetWatchOptions: new AsyncSeriesWaterfallHook(['watchOptions', 'rspackConfiguration']) + }; +} diff --git a/heft-plugins/heft-rspack-plugin/src/index.ts b/heft-plugins/heft-rspack-plugin/src/index.ts index 5bd0f7b87e4..2374dd23841 100644 --- a/heft-plugins/heft-rspack-plugin/src/index.ts +++ b/heft-plugins/heft-rspack-plugin/src/index.ts @@ -1,13 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. // See LICENSE in the project root for license information. -import type { IHeftPlugin } from '@rushstack/heft'; - -import { RspackPlugin } from './RspackPlugin'; - -export { IRspackConfiguration, IRspackBuildStageProperties, IRspackBundleSubstageProperties } from './shared'; - -/** - * @public - */ -export default new RspackPlugin() as IHeftPlugin; +export { + IRspackConfiguration, + IRspackConfigurationFnEnvironment, + IRspackPluginAccessor, + IRspackPluginAccessorHooks, + IRspackPluginAccessorParameters +} from './shared'; diff --git a/heft-plugins/heft-rspack-plugin/src/schemas/heft-rspack-plugin.schema.json b/heft-plugins/heft-rspack-plugin/src/schemas/heft-rspack-plugin.schema.json new file mode 100644 index 00000000000..3a488443547 --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/src/schemas/heft-rspack-plugin.schema.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Rspack Plugin Configuration", + "description": "Defines options for Rspack plugin execution.", + "type": "object", + + "additionalProperties": false, + + "properties": { + "$schema": { + "description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.", + "type": "string" + }, + + "devConfigurationPath": { + "description": "Specifies a relative path to the Rspack dev configuration, which is used in \"serve\" mode. The default value is \"./rspack.dev.config.js\".", + "type": "string" + }, + + "configurationPath": { + "description": "Specifies a relative path to the Rspack configuration. The default value is \"./rspack.config.js\".", + "type": "string" + } + } +} diff --git a/heft-plugins/heft-rspack-plugin/src/shared.ts b/heft-plugins/heft-rspack-plugin/src/shared.ts index 960a496847f..6340fe69ecf 100644 --- a/heft-plugins/heft-rspack-plugin/src/shared.ts +++ b/heft-plugins/heft-rspack-plugin/src/shared.ts @@ -1,36 +1,121 @@ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. // See LICENSE in the project root for license information. -import type * as rspack from '@rspack/core'; -import type { IBuildStageProperties, IBundleSubstageProperties } from '@rushstack/heft'; +import type * as TRspack from '@rspack/core'; +import type { HeftConfiguration, IHeftTaskSession } from '@rushstack/heft'; +import { AsyncParallelHook, AsyncSeriesBailHook, AsyncSeriesHook, AsyncSeriesWaterfallHook } from 'tapable'; /** + * The environment passed into the Webpack configuration function. Loosely based + * on the default Webpack environment options, specified here: + * https://webpack.js.org/api/cli/#environment-options + * * @public */ -export type IRspackConfiguration = rspack.Configuration | rspack.Configuration[] | undefined; +export interface IRspackConfigurationFnEnvironment { + /** + * Whether or not the run is in production mode. Synonym of + * {@link IRspackConfigurationFnEnvironment.production}. + */ + prod: boolean; + /** + * Whether or not the run is in production mode. Synonym of + * {@link IRspackConfigurationFnEnvironment.prod}. + */ + production: boolean; + + // Non-standard environment options + /** + * The task session provided to the plugin. + */ + taskSession: IHeftTaskSession; + /** + * The Heft configuration provided to the plugin. + */ + heftConfiguration: HeftConfiguration; + /** + * The resolved Rspack package. + */ + rspack: typeof TRspack; +} + +/** + * @public + */ +export type IRspackConfiguration = TRspack.Configuration | TRspack.Configuration[]; /** * @public */ -export interface IRspackBundleSubstageProperties extends IBundleSubstageProperties { +export interface IRspackPluginAccessorHooks { /** - * The configuration used by the rspack plugin. This must be populated - * for rspack to run. If rspackConfigFilePath is specified, - * this will be populated automatically with the exports of the - * config file referenced in that property. + * A hook that allows for loading custom configurations used by the Rspack + * plugin. If a tap returns a value other than `undefined` before stage {@link STAGE_LOAD_LOCAL_CONFIG}, + * it will suppress loading from the Rspack config file. To provide a fallback behavior in the + * absence of a local config file, tap this hook with a `stage` value greater than {@link STAGE_LOAD_LOCAL_CONFIG}. * * @remarks - * Tapable event handlers can return `null` instead of `undefined` to suppress - * other handlers from creating a configuration object. + * Tapable event handlers can return `false` instead of `undefined` to suppress + * other handlers from creating a configuration object, and prevent Rspack from running. + */ + readonly onLoadConfiguration: AsyncSeriesBailHook; + /** + * A hook that allows for modification of the loaded configuration used by the Rspack + * plugin. If no configuration was loaded, this hook will not be called. + */ + readonly onConfigure: AsyncSeriesHook; + /** + * A hook that provides the finalized configuration that will be used by Rspack. + * If no configuration was loaded, this hook will not be called. + */ + readonly onAfterConfigure: AsyncParallelHook; + /** + * A hook that provides the stats output from Rspack. If no configuration is loaded, + * this hook will not be called. */ - // We are inheriting this problem from Tapable's API - // eslint-disable-next-line @rushstack/no-new-null - rspackConfiguration?: rspack.Configuration | rspack.Configuration[] | null; + readonly onEmitStats: AsyncParallelHook; + /** + * A hook that allows for customization of the file watcher options. If not running in watch mode, this hook will not be called. + */ + readonly onGetWatchOptions: AsyncSeriesWaterfallHook< + Parameters[0], + Readonly, + never + >; } /** * @public */ -export interface IRspackBuildStageProperties extends IBuildStageProperties { - rspackStats?: rspack.Stats; +export interface IRspackPluginAccessorParameters { + /** + * Whether or not serve mode was enabled by passing the `--serve` flag. + */ + readonly isServeMode: boolean; } + +/** + * @public + */ +export interface IRspackPluginAccessor { + /** + * Hooks that are called at various points in the Webpack plugin lifecycle. + */ + readonly hooks: IRspackPluginAccessorHooks; + /** + * Parameters that are provided by the Webpack plugin. + */ + readonly parameters: IRspackPluginAccessorParameters; +} + +/** + * The stage in the `onLoadConfiguration` hook at which the config will be loaded from the local + * webpack config file. + * @public + */ +export const STAGE_LOAD_LOCAL_CONFIG: 1000 = 1000; + +/** + * @public + */ +export const PLUGIN_NAME: 'webpack5-plugin' = 'webpack5-plugin'; diff --git a/heft-plugins/heft-webpack5-plugin/src/shared.ts b/heft-plugins/heft-webpack5-plugin/src/shared.ts index def9c86ea17..7975bcec0c0 100644 --- a/heft-plugins/heft-webpack5-plugin/src/shared.ts +++ b/heft-plugins/heft-webpack5-plugin/src/shared.ts @@ -22,12 +22,12 @@ import type { IHeftTaskSession, HeftConfiguration } from '@rushstack/heft'; export interface IWebpackConfigurationFnEnvironment { /** * Whether or not the run is in production mode. Synonym of - * IWebpackConfigurationFnEnvironment.production. + * {@link IWebpackConfigurationFnEnvironment.production}. */ prod: boolean; /** * Whether or not the run is in production mode. Synonym of - * IWebpackConfigurationFnEnvironment.prod. + * {@link IWebpackConfigurationFnEnvironment.prod}. */ production: boolean; diff --git a/heft-plugins/heft-webpack5-plugin/src/WebpackConfigurationLoader.test.ts b/heft-plugins/heft-webpack5-plugin/src/test/WebpackConfigurationLoader.test.ts similarity index 97% rename from heft-plugins/heft-webpack5-plugin/src/WebpackConfigurationLoader.test.ts rename to heft-plugins/heft-webpack5-plugin/src/test/WebpackConfigurationLoader.test.ts index 6795bae6f88..855acc231cf 100644 --- a/heft-plugins/heft-webpack5-plugin/src/WebpackConfigurationLoader.test.ts +++ b/heft-plugins/heft-webpack5-plugin/src/test/WebpackConfigurationLoader.test.ts @@ -5,9 +5,9 @@ import type { HeftConfiguration, IHeftParameters, IHeftTaskSession, IScopedLogge import { MockScopedLogger } from '@rushstack/heft/lib/pluginFramework/logging/MockScopedLogger'; import { type ITerminal, StringBufferTerminalProvider, Terminal } from '@rushstack/terminal'; -import * as WebpackConfigurationLoader from './WebpackConfigurationLoader'; -import { _createAccessorHooks } from './Webpack5Plugin'; -import { type IWebpackConfiguration, STAGE_LOAD_LOCAL_CONFIG } from './shared'; +import * as WebpackConfigurationLoader from '../WebpackConfigurationLoader'; +import { _createAccessorHooks } from '../Webpack5Plugin'; +import { type IWebpackConfiguration, STAGE_LOAD_LOCAL_CONFIG } from '../shared'; interface IMockLoadWebpackConfigurationOptions extends WebpackConfigurationLoader.ILoadWebpackConfigurationOptions { From c5efc462a7c514572fd9c94e5c5c4847d5095077 Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Mon, 6 Oct 2025 21:31:48 -0700 Subject: [PATCH 03/24] fixup plugin implementation --- heft-plugins/heft-rspack-plugin/.eslintrc.js | 10 --- heft-plugins/heft-rspack-plugin/.npmignore | 17 +++-- heft-plugins/heft-rspack-plugin/README.md | 6 +- .../heft-rspack-plugin/eslint.config.js | 18 ++++++ heft-plugins/heft-rspack-plugin/package.json | 28 ++++---- .../src/RspackConfigurationLoader.ts | 13 ++-- .../heft-rspack-plugin/src/RspackPlugin.ts | 64 +++++++++++-------- heft-plugins/heft-rspack-plugin/src/index.ts | 5 +- heft-plugins/heft-rspack-plugin/src/shared.ts | 38 +++++++---- heft-plugins/heft-rspack-plugin/tsconfig.json | 9 +-- 10 files changed, 128 insertions(+), 80 deletions(-) delete mode 100644 heft-plugins/heft-rspack-plugin/.eslintrc.js create mode 100644 heft-plugins/heft-rspack-plugin/eslint.config.js diff --git a/heft-plugins/heft-rspack-plugin/.eslintrc.js b/heft-plugins/heft-rspack-plugin/.eslintrc.js deleted file mode 100644 index 4c934799d67..00000000000 --- a/heft-plugins/heft-rspack-plugin/.eslintrc.js +++ /dev/null @@ -1,10 +0,0 @@ -// This is a workaround for https://github.com/eslint/eslint/issues/3458 -require('@rushstack/eslint-config/patch/modern-module-resolution'); - -module.exports = { - extends: [ - '@rushstack/eslint-config/profile/node-trusted-tool', - '@rushstack/eslint-config/mixins/friendly-locals' - ], - parserOptions: { tsconfigRootDir: __dirname } -}; diff --git a/heft-plugins/heft-rspack-plugin/.npmignore b/heft-plugins/heft-rspack-plugin/.npmignore index ad6bcd960e8..ffb155d74e6 100644 --- a/heft-plugins/heft-rspack-plugin/.npmignore +++ b/heft-plugins/heft-rspack-plugin/.npmignore @@ -8,6 +8,11 @@ !/lib/** !/lib-*/** !/dist/** + +!CHANGELOG.md +!CHANGELOG.json +!heft-plugin.json +!rush-plugin-manifest.json !ThirdPartyNotice.txt # Ignore certain patterns that should not get published. @@ -19,13 +24,11 @@ # NOTE: These don't need to be specified, because NPM includes them automatically. # # package.json -# README (and its variants) -# CHANGELOG (and its variants) -# LICENSE / LICENCE +# README.md +# LICENSE -#-------------------------------------------- -# DO NOT MODIFY THE TEMPLATE ABOVE THIS LINE -#-------------------------------------------- +# --------------------------------------------------------------------------- +# DO NOT MODIFY ABOVE THIS LINE! Add any project-specific overrides below. +# --------------------------------------------------------------------------- -# (Add your project-specific overrides here) !/includes/** diff --git a/heft-plugins/heft-rspack-plugin/README.md b/heft-plugins/heft-rspack-plugin/README.md index 3dcab2dbe8f..91a8874cfa1 100644 --- a/heft-plugins/heft-rspack-plugin/README.md +++ b/heft-plugins/heft-rspack-plugin/README.md @@ -1,10 +1,12 @@ # @rushstack/heft-rspack-plugin -This is a Heft plugin for using Rspack during the "bundle" stage. +This is a Heft plugin for using Rspack. ## Links -- [CHANGELOG.md](https://github.com/microsoft/rushstack/blob/main/heft-plugins/heft-rspack-plugin/CHANGELOG.md) - Find +- [CHANGELOG.md]( + https://github.com/microsoft/rushstack/blob/main/heft-plugins/heft-rspack-plugin/CHANGELOG.md) - Find out what's new in the latest version +- [@rushstack/heft](https://www.npmjs.com/package/@rushstack/heft) - Heft is a config-driven toolchain that invokes popular tools such as TypeScript, ESLint, Jest, Webpack, and API Extractor. Heft is part of the [Rush Stack](https://rushstack.io/) family of projects. diff --git a/heft-plugins/heft-rspack-plugin/eslint.config.js b/heft-plugins/heft-rspack-plugin/eslint.config.js new file mode 100644 index 00000000000..c15e6077310 --- /dev/null +++ b/heft-plugins/heft-rspack-plugin/eslint.config.js @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +const nodeTrustedToolProfile = require('local-node-rig/profiles/default/includes/eslint/flat/profile/node-trusted-tool'); +const friendlyLocalsMixin = require('local-node-rig/profiles/default/includes/eslint/flat/mixins/friendly-locals'); + +module.exports = [ + ...nodeTrustedToolProfile, + ...friendlyLocalsMixin, + { + files: ['**/*.ts', '**/*.tsx'], + languageOptions: { + parserOptions: { + tsconfigRootDir: __dirname + } + } + } +]; diff --git a/heft-plugins/heft-rspack-plugin/package.json b/heft-plugins/heft-rspack-plugin/package.json index 223bbab0d84..f579bef8954 100644 --- a/heft-plugins/heft-rspack-plugin/package.json +++ b/heft-plugins/heft-rspack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@rushstack/heft-rspack-plugin", - "version": "0.0.0", + "version": "0.11.43", "description": "Heft plugin for Rspack", "repository": { "type": "git", @@ -14,25 +14,29 @@ "scripts": { "build": "heft build --clean", "start": "heft test --clean --watch", - "_phase:build": "heft build --clean", - "_phase:test": "heft test --no-build" + "_phase:build": "heft run --only build -- --clean", + "_phase:test": "heft run --only test -- --clean" }, "peerDependencies": { - "@rushstack/heft": "^0.49.7", - "@rspack/core": "^0.1.1" + "@rushstack/heft": "^0.75.0", + "@rspack/core": "^1.5.8" }, "dependencies": { + "@rushstack/debug-certificate-manager": "workspace:*", "@rushstack/node-core-library": "workspace:*", "@types/tapable": "1.0.6", "tapable": "1.1.3", - "@rushstack/debug-certificate-manager": "workspace:*", - "webpack-dev-server": "^5.1.0" + "watchpack": "2.4.0", + "@rspack/dev-server": "^1.1.4" }, "devDependencies": { - "@rushstack/eslint-config": "workspace:*", "@rushstack/heft": "workspace:*", - "@rushstack/heft-node-rig": "workspace:*", - "@types/node": "20.17.19", - "@rspack/core": "^1.2.8" + "@rushstack/terminal": "workspace:*", + "@types/watchpack": "2.4.0", + "eslint": "~9.25.1", + "local-node-rig": "workspace:*", + "@rspack/core": "~1.5.8", + "webpack": "~5.98.0", + "webpack-dev-server": "^5.1.0" } -} +} \ No newline at end of file diff --git a/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts b/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts index 3bf8c649200..7a84712255b 100644 --- a/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts +++ b/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. // See LICENSE in the project root for license information. -import * as path from 'path'; +import * as path from 'node:path'; + import type * as TRspack from '@rspack/core'; + import { FileSystem } from '@rushstack/node-core-library'; import type { IHeftTaskSession, HeftConfiguration } from '@rushstack/heft'; @@ -31,7 +33,7 @@ export interface ILoadRspackConfigurationOptions { taskSession: IHeftTaskSession; heftConfiguration: HeftConfiguration; serveMode: boolean; - loadRspackAsyncFn: () => Promise; + loadRspackAsyncFn: () => Promise; hooks: Pick; _tryLoadConfigFileAsync?: typeof tryLoadRspackConfigurationFileAsync; @@ -90,7 +92,7 @@ export async function tryLoadRspackConfigurationAsync( rspackConfiguration = undefined; } else { if (hooks.onConfigure.isUsed()) { - // Allow for plugins to customise the configuration + // Allow for plugins to customize the configuration await hooks.onConfigure.promise(rspackConfiguration); } if (hooks.onAfterConfigure.isUsed()) { @@ -98,7 +100,7 @@ export async function tryLoadRspackConfigurationAsync( await hooks.onAfterConfigure.promise(rspackConfiguration); } } - return rspackConfiguration; + return rspackConfiguration as IRspackConfiguration | undefined; } /** @@ -142,7 +144,8 @@ export async function tryLoadRspackConfigurationFileAsync( if (rspackConfigJs) { const rspackConfig: IRspackConfigJsExport = - (rspackConfigJs as { default: IRspackConfigJsExport }).default || rspackConfigJs; + (rspackConfigJs as { default: IRspackConfigJsExport }).default || + (rspackConfigJs as IRspackConfigJsExport); if (typeof rspackConfig === 'function') { // Defer loading of rspack until we know for sure that we will need it diff --git a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts index 6d9d00b7661..c55ae5f267d 100644 --- a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts +++ b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. // See LICENSE in the project root for license information. -import type { AddressInfo } from 'net'; +import type { AddressInfo } from 'node:net'; import type * as TRspack from '@rspack/core'; -import type TWebpackDevServer from 'webpack-dev-server'; +import type * as TRspackDevServer from '@rspack/dev-server'; import { AsyncParallelHook, AsyncSeriesBailHook, AsyncSeriesHook, AsyncSeriesWaterfallHook } from 'tapable'; import { CertificateManager, type ICertificate } from '@rushstack/debug-certificate-manager'; @@ -22,7 +22,8 @@ import { type IRspackConfiguration, type IRspackPluginAccessor, PLUGIN_NAME, - type IRspackPluginAccessorHooks + type IRspackPluginAccessorHooks, + type RspackCoreImport } from './shared'; import { tryLoadRspackConfigurationAsync } from './RspackConfigurationLoader'; @@ -32,8 +33,8 @@ export interface IRspackPluginOptions { } const SERVE_PARAMETER_LONG_NAME: '--serve' = '--serve'; const RSPACK_PACKAGE_NAME: '@rspack/core' = '@rspack/core'; -const WEBPACK_DEV_SERVER_PACKAGE_NAME: 'webpack-dev-server' = 'webpack-dev-server'; -const WEBPACK_DEV_SERVER_ENV_VAR_NAME: 'WEBPACK_DEV_SERVER' = 'WEBPACK_DEV_SERVER'; +const RSPACK_DEV_SERVER_PACKAGE_NAME: '@rspack/dev-server' = '@rspack/dev-server'; +const RSPACK_DEV_SERVER_ENV_VAR_NAME: 'RSPACK_DEV_SERVER' = 'RSPACK_DEV_SERVER'; const WEBPACK_DEV_MIDDLEWARE_PACKAGE_NAME: 'webpack-dev-middleware' = 'webpack-dev-middleware'; /** @@ -42,7 +43,7 @@ const WEBPACK_DEV_MIDDLEWARE_PACKAGE_NAME: 'webpack-dev-middleware' = 'webpack-d export default class RspackPlugin implements IHeftTaskPlugin { private _accessor: IRspackPluginAccessor | undefined; private _isServeMode: boolean = false; - private _rspack: typeof TRspack | undefined; + private _rspack: RspackCoreImport | undefined; private _rspackCompiler: TRspack.Compiler | TRspack.MultiCompiler | undefined; private _rspackConfiguration: IRspackConfiguration | undefined | false = false; private _rspackCompilationDonePromise: Promise | undefined; @@ -115,7 +116,7 @@ export default class RspackPlugin implements IHeftTaskPlugin { + private async _loadRspackAsync(): Promise { if (!this._rspack) { // Allow this to fail if Rspack is not installed this._rspack = await import(RSPACK_PACKAGE_NAME); @@ -128,7 +129,7 @@ export default class RspackPlugin implements IHeftTaskPlugin { if (!this._rspackCompiler) { - const rspack: typeof TRspack = await this._loadRspackAsync(); + const rspack: RspackCoreImport = await this._loadRspackAsync(); taskSession.logger.terminal.writeLine(`Using Rspack version ${rspack.version}`); this._rspackCompiler = Array.isArray(rspackConfiguration) ? rspack.default(rspackConfiguration) /* (rspack.Compilation[]) => MultiCompiler */ @@ -236,9 +237,9 @@ export default class RspackPlugin implements IHeftTaskPlugin { + onListening: (server: TRspackDevServer.RspackDevServer) => { const addressInfo: AddressInfo | string | undefined = server.server?.address() as AddressInfo; if (addressInfo) { const address: string = typeof addressInfo === 'string' ? addressInfo : `${addressInfo.address}:${addressInfo.port}`; - taskSession.logger.terminal.writeLine(`Started Webpack Dev Server at https://${address}`); + taskSession.logger.terminal.writeLine(`Started Rspack Dev Server at https://${address}`); } } }; - // Obtain the devServerOptions from the webpack configuration, and combine with the default options - let devServerOptions: TWebpackDevServer.Configuration; + // Obtain the devServerOptions from the rspack configuration, and combine with the default options + let devServerOptions: TRspackDevServer.Configuration; if (Array.isArray(rspackConfiguration)) { - const filteredDevServerOptions: TWebpackDevServer.Configuration[] = rspackConfiguration + const filteredDevServerOptions: TRspackDevServer.Configuration[] = rspackConfiguration .map((configuration) => configuration.devServer) - .filter((devServer): devServer is TWebpackDevServer.Configuration => !!devServer); + .filter((devServer): devServer is TRspackDevServer.Configuration => !!devServer); if (filteredDevServerOptions.length > 1) { taskSession.logger.emitWarning( new Error(`Detected multiple rspack devServer configurations, using the first one.`) @@ -290,7 +293,7 @@ export default class RspackPlugin implements IHeftTaskPlugin { @@ -336,22 +338,28 @@ export default class RspackPlugin implements IHeftTaskPlugin[0] = onGetWatchOptions.isUsed() + const watchOptions: + | Parameters[0] + | Parameters[0] = onGetWatchOptions.isUsed() ? await onGetWatchOptions.promise({}, rspackConfiguration) : {}; - compiler.watch(watchOptions, (error?: Error | null) => { + (compiler as TRspack.Compiler).watch(watchOptions, (error?: Error | null) => { if (error) { taskSession.logger.emitError(error); } @@ -368,12 +376,12 @@ export default class RspackPlugin implements IHeftTaskPlugin Date: Mon, 6 Oct 2025 21:31:59 -0700 Subject: [PATCH 04/24] api extractor --- common/reviews/api/heft-rspack-plugin.api.md | 64 ++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 common/reviews/api/heft-rspack-plugin.api.md diff --git a/common/reviews/api/heft-rspack-plugin.api.md b/common/reviews/api/heft-rspack-plugin.api.md new file mode 100644 index 00000000000..1127c379193 --- /dev/null +++ b/common/reviews/api/heft-rspack-plugin.api.md @@ -0,0 +1,64 @@ +## API Report File for "@rushstack/heft-rspack-plugin" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { AsyncParallelHook } from 'tapable'; +import type { AsyncSeriesBailHook } from 'tapable'; +import type { AsyncSeriesHook } from 'tapable'; +import type { AsyncSeriesWaterfallHook } from 'tapable'; +import type { HeftConfiguration } from '@rushstack/heft'; +import type { IHeftTaskSession } from '@rushstack/heft'; +import { rspackCore } from '@rspack/core'; +import type * as TRspack from '@rspack/core'; +import type * as TRspackDevServer from '@rspack/dev-server'; + +// @beta (undocumented) +export type IRspackConfiguration = TRspack.Configuration | TRspack.Configuration[]; + +// @beta +export interface IRspackConfigurationFnEnvironment { + heftConfiguration: HeftConfiguration; + prod: boolean; + production: boolean; + // Warning: (ae-forgotten-export) The symbol "RspackCoreImport" needs to be exported by the entry point index.d.ts + rspack: RspackCoreImport; + taskSession: IHeftTaskSession; +} + +// @beta (undocumented) +export interface IRspackConfigurationWithDevServer extends TRspack.Configuration { + // (undocumented) + devServer?: TRspackDevServer.Configuration; +} + +// @beta (undocumented) +export interface IRspackPluginAccessor { + readonly hooks: IRspackPluginAccessorHooks; + readonly parameters: IRspackPluginAccessorParameters; +} + +// @beta (undocumented) +export interface IRspackPluginAccessorHooks { + readonly onAfterConfigure: AsyncParallelHook; + readonly onConfigure: AsyncSeriesHook; + readonly onEmitStats: AsyncParallelHook; + readonly onGetWatchOptions: AsyncSeriesWaterfallHook[0], Readonly, never>; + readonly onLoadConfiguration: AsyncSeriesBailHook; +} + +// @beta (undocumented) +export interface IRspackPluginAccessorParameters { + readonly isServeMode: boolean; +} + +// @beta (undocumented) +export const PluginName: 'rspack-plugin'; + +// @beta +export const STAGE_LOAD_LOCAL_CONFIG: 1000; + +// (No @packageDocumentation comment for this package) + +``` From 62436d30e68868ba60af101339b6720c64fb5442 Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Mon, 6 Oct 2025 21:32:54 -0700 Subject: [PATCH 05/24] heft-rspack-everything-test --- .../config/heft.json | 66 ++++++++++ .../config/jest.config.json | 12 ++ .../config/rush-project.json | 14 ++ .../config/typescript.json | 55 ++++++++ .../eslint.config.js | 16 +++ .../heft-rspack-everything-test/package.json | 34 +++++ .../rspack.config.js | 41 ++++++ .../rspack.dev.config.js | 36 ++++++ .../src/chunks/ChunkClass.ts | 14 ++ .../src/chunks/image.d.png.ts | 6 + .../src/chunks/image.png | Bin 0 -> 726 bytes .../src/copiedAsset.css | 1 + .../heft-rspack-everything-test/src/indexA.ts | 10 ++ .../heft-rspack-everything-test/src/indexB.ts | 5 + .../src/test/ExampleTest.test.ts | 16 +++ .../src/test/Image.test.ts | 10 ++ .../src/test/SourceMapTest.test.ts | 120 ++++++++++++++++++ .../heft-rspack-everything-test/tsconfig.json | 29 +++++ rush.json | 6 + 19 files changed, 491 insertions(+) create mode 100644 build-tests/heft-rspack-everything-test/config/heft.json create mode 100644 build-tests/heft-rspack-everything-test/config/jest.config.json create mode 100644 build-tests/heft-rspack-everything-test/config/rush-project.json create mode 100644 build-tests/heft-rspack-everything-test/config/typescript.json create mode 100644 build-tests/heft-rspack-everything-test/eslint.config.js create mode 100644 build-tests/heft-rspack-everything-test/package.json create mode 100644 build-tests/heft-rspack-everything-test/rspack.config.js create mode 100644 build-tests/heft-rspack-everything-test/rspack.dev.config.js create mode 100644 build-tests/heft-rspack-everything-test/src/chunks/ChunkClass.ts create mode 100644 build-tests/heft-rspack-everything-test/src/chunks/image.d.png.ts create mode 100644 build-tests/heft-rspack-everything-test/src/chunks/image.png create mode 100644 build-tests/heft-rspack-everything-test/src/copiedAsset.css create mode 100644 build-tests/heft-rspack-everything-test/src/indexA.ts create mode 100644 build-tests/heft-rspack-everything-test/src/indexB.ts create mode 100644 build-tests/heft-rspack-everything-test/src/test/ExampleTest.test.ts create mode 100644 build-tests/heft-rspack-everything-test/src/test/Image.test.ts create mode 100644 build-tests/heft-rspack-everything-test/src/test/SourceMapTest.test.ts create mode 100644 build-tests/heft-rspack-everything-test/tsconfig.json diff --git a/build-tests/heft-rspack-everything-test/config/heft.json b/build-tests/heft-rspack-everything-test/config/heft.json new file mode 100644 index 00000000000..7d826b05556 --- /dev/null +++ b/build-tests/heft-rspack-everything-test/config/heft.json @@ -0,0 +1,66 @@ +/** + * Defines configuration used by core Heft. + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft.schema.json", + + // TODO: Add comments + "phasesByName": { + "build": { + "cleanFiles": [{ "includeGlobs": ["dist", "lib", "lib-commonjs"] }], + + "tasksByName": { + "typescript": { + "taskPlugin": { + "pluginPackage": "@rushstack/heft-typescript-plugin" + } + }, + "lint": { + "taskDependencies": ["typescript"], + "taskPlugin": { + "pluginPackage": "@rushstack/heft-lint-plugin" + } + }, + "rspack": { + "taskDependencies": ["typescript"], + "taskPlugin": { + "pluginPackage": "@rushstack/heft-rspack-plugin" + } + } + } + }, + + "test": { + "phaseDependencies": ["build"], + "tasksByName": { + "jest": { + "taskPlugin": { + "pluginPackage": "@rushstack/heft-jest-plugin" + } + } + } + }, + + "trust-dev-cert": { + "tasksByName": { + "trust-dev-cert": { + "taskPlugin": { + "pluginPackage": "@rushstack/heft-dev-cert-plugin", + "pluginName": "trust-dev-certificate-plugin" + } + } + } + }, + + "untrust-dev-cert": { + "tasksByName": { + "untrust-dev-cert": { + "taskPlugin": { + "pluginPackage": "@rushstack/heft-dev-cert-plugin", + "pluginName": "untrust-dev-certificate-plugin" + } + } + } + } + } +} diff --git a/build-tests/heft-rspack-everything-test/config/jest.config.json b/build-tests/heft-rspack-everything-test/config/jest.config.json new file mode 100644 index 00000000000..f22bb14d6d1 --- /dev/null +++ b/build-tests/heft-rspack-everything-test/config/jest.config.json @@ -0,0 +1,12 @@ +{ + "extends": "@rushstack/heft-jest-plugin/includes/jest-web.config.json", + + // Enable code coverage for Jest + "collectCoverage": true, + "coverageDirectory": "/coverage", + "coverageReporters": ["cobertura", "html"], + + // Use v8 coverage provider to avoid Babel + "coverageProvider": "v8", + "resolver": "@rushstack/heft-jest-plugin/lib/exports/jest-node-modules-symlink-resolver" +} diff --git a/build-tests/heft-rspack-everything-test/config/rush-project.json b/build-tests/heft-rspack-everything-test/config/rush-project.json new file mode 100644 index 00000000000..030d8d0ff0e --- /dev/null +++ b/build-tests/heft-rspack-everything-test/config/rush-project.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-project.schema.json", + + "operationSettings": [ + { + "operationName": "_phase:build", + "outputFolderNames": ["lib", "dist"] + }, + { + "operationName": "_phase:test", + "outputFolderNames": ["coverage"] + } + ] +} diff --git a/build-tests/heft-rspack-everything-test/config/typescript.json b/build-tests/heft-rspack-everything-test/config/typescript.json new file mode 100644 index 00000000000..86a32ee3552 --- /dev/null +++ b/build-tests/heft-rspack-everything-test/config/typescript.json @@ -0,0 +1,55 @@ +/** + * Configures the TypeScript plugin for Heft. This plugin also manages linting. + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/heft/v0/typescript.schema.json", + + /** + * If provided, emit these module kinds in addition to the modules specified in the tsconfig. + * Note that this option only applies to the main tsconfig.json configuration. + */ + "additionalModuleKindsToEmit": [ + // { + // /** + // * (Required) Must be one of "commonjs", "amd", "umd", "system", "es2015", "esnext" + // */ + // "moduleKind": "amd", + // + // /** + // * (Required) The name of the folder where the output will be written. + // */ + // "outFolderName": "lib-amd" + // } + { + "moduleKind": "commonjs", + "outFolderName": "lib-commonjs" + } + ], + + /** + * Describes the way files should be statically coped from src to TS output folders + */ + "staticAssetsToCopy": { + /** + * File extensions that should be copied from the src folder to the destination folder(s). + */ + "fileExtensions": [".css", ".png"] + + /** + * Glob patterns that should be explicitly included. + */ + // "includeGlobs": [ + // "some/path/*.js" + // ], + + /** + * Glob patterns that should be explicitly excluded. This takes precedence over globs listed + * in "includeGlobs" and files that match the file extensions provided in "fileExtensions". + */ + // "excludeGlobs": [ + // "some/path/*.css" + // ] + }, + + "onlyResolveSymlinksInNodeModules": true +} diff --git a/build-tests/heft-rspack-everything-test/eslint.config.js b/build-tests/heft-rspack-everything-test/eslint.config.js new file mode 100644 index 00000000000..5a9df48909b --- /dev/null +++ b/build-tests/heft-rspack-everything-test/eslint.config.js @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +const webAppProfile = require('local-eslint-config/flat/profile/web-app'); + +module.exports = [ + ...webAppProfile, + { + files: ['**/*.ts', '**/*.tsx'], + languageOptions: { + parserOptions: { + tsconfigRootDir: __dirname + } + } + } +]; diff --git a/build-tests/heft-rspack-everything-test/package.json b/build-tests/heft-rspack-everything-test/package.json new file mode 100644 index 00000000000..8b59e2b2cf9 --- /dev/null +++ b/build-tests/heft-rspack-everything-test/package.json @@ -0,0 +1,34 @@ +{ + "name": "heft-rspack-everything-test", + "description": "Building this project tests every task and config file for Heft when targeting the web browser runtime using Rspack", + "version": "1.0.0", + "private": true, + "scripts": { + "build": "heft build --clean", + "start": "heft build-watch", + "serve": "heft build-watch --serve", + "_phase:build": "heft run --only build -- --clean", + "_phase:build:ipc": "heft run-watch --only build -- --clean", + "_phase:test": "heft run --only test -- --clean", + "_phase:test:ipc": "heft run-watch --only test -- --clean" + }, + "devDependencies": { + "@rushstack/heft-dev-cert-plugin": "workspace:*", + "@rushstack/heft-jest-plugin": "workspace:*", + "@rushstack/heft-lint-plugin": "workspace:*", + "@rushstack/heft-typescript-plugin": "workspace:*", + "@rushstack/heft-rspack-plugin": "workspace:*", + "@rushstack/heft": "workspace:*", + "@rushstack/node-core-library": "workspace:*", + "@rushstack/rush-sdk": "workspace:*", + "@types/heft-jest": "1.0.1", + "@types/node": "20.17.19", + "eslint": "~9.25.1", + "local-eslint-config": "workspace:*", + "source-map-loader": "~3.0.1", + "typescript": "~5.8.2", + "@rspack/core": "~1.5.8", + "webpack": "~5.98.0", + "webpack-dev-server": "^5.1.0" + } +} \ No newline at end of file diff --git a/build-tests/heft-rspack-everything-test/rspack.config.js b/build-tests/heft-rspack-everything-test/rspack.config.js new file mode 100644 index 00000000000..6048d76d45f --- /dev/null +++ b/build-tests/heft-rspack-everything-test/rspack.config.js @@ -0,0 +1,41 @@ +'use strict'; + +const path = require('path'); +const { HtmlRspackPlugin, SwcJsMinimizerRspackPlugin } = require('@rspack/core'); + +module.exports = { + mode: 'production', + module: { + rules: [ + { + test: /\.png$/i, + type: 'asset/resource' + }, + { + test: /\.js$/, + enforce: 'pre', + use: ['source-map-loader'] + } + ] + }, + target: ['web', 'es2020'], + resolve: { + extensions: ['.js', '.jsx', '.json'] + }, + entry: { + 'heft-test-A': path.join(__dirname, 'lib', 'indexA.js'), + 'heft-test-B': path.join(__dirname, 'lib', 'indexB.js') + }, + output: { + path: path.join(__dirname, 'dist'), + filename: '[name]_[contenthash].js', + chunkFilename: '[id].[name]_[contenthash].js', + assetModuleFilename: '[name]_[contenthash][ext][query]' + }, + devtool: 'source-map', + optimization: { + minimize: true, + minimizer: [new SwcJsMinimizerRspackPlugin({})] + }, + plugins: [new HtmlRspackPlugin()] +}; diff --git a/build-tests/heft-rspack-everything-test/rspack.dev.config.js b/build-tests/heft-rspack-everything-test/rspack.dev.config.js new file mode 100644 index 00000000000..5a716d9bbb8 --- /dev/null +++ b/build-tests/heft-rspack-everything-test/rspack.dev.config.js @@ -0,0 +1,36 @@ +'use strict'; + +const path = require('path'); +const { HtmlRspackPlugin } = require('@rspack/core'); + +module.exports = { + mode: 'none', + module: { + rules: [ + { + test: /\.png$/i, + type: 'asset/resource' + } + ] + }, + target: ['web', 'es2020'], + resolve: { + extensions: ['.js', '.jsx', '.json'] + }, + entry: { + 'heft-test-A': path.join(__dirname, 'lib', 'indexA.js'), + 'heft-test-B': path.join(__dirname, 'lib', 'indexB.js') + }, + output: { + path: path.join(__dirname, 'dist'), + filename: '[name]_[contenthash].js', + chunkFilename: '[id].[name]_[contenthash].js', + assetModuleFilename: '[name]_[contenthash][ext][query]' + }, + devtool: 'source-map', + optimization: { + minimize: false, + minimizer: [] + }, + plugins: [new HtmlRspackPlugin()] +}; diff --git a/build-tests/heft-rspack-everything-test/src/chunks/ChunkClass.ts b/build-tests/heft-rspack-everything-test/src/chunks/ChunkClass.ts new file mode 100644 index 00000000000..ddbf7d148c7 --- /dev/null +++ b/build-tests/heft-rspack-everything-test/src/chunks/ChunkClass.ts @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +export class ChunkClass { + public doStuff(): void { + // eslint-disable-next-line no-console + console.log('CHUNK'); + } + + public getImageUrl(): string { + // eslint-disable-next-line @typescript-eslint/no-require-imports + return require('./image.png'); + } +} diff --git a/build-tests/heft-rspack-everything-test/src/chunks/image.d.png.ts b/build-tests/heft-rspack-everything-test/src/chunks/image.d.png.ts new file mode 100644 index 00000000000..f38a285dfd9 --- /dev/null +++ b/build-tests/heft-rspack-everything-test/src/chunks/image.d.png.ts @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +declare const path: string; + +export default path; diff --git a/build-tests/heft-rspack-everything-test/src/chunks/image.png b/build-tests/heft-rspack-everything-test/src/chunks/image.png new file mode 100644 index 0000000000000000000000000000000000000000..a028cfeb69f228b4a78c2c22e26d98a6e9b53cf8 GIT binary patch literal 726 zcmeAS@N?(olHy`uVBq!ia0vp^kAe6d2NRHVDN;WQq!^2X+?^QKos)S9a~60+7BevL9R^{> { + const chunk: any = new ChunkClass(); + chunk.doStuff(); + }) + .catch((e) => { + console.log('Error: ' + e.message); + }); diff --git a/build-tests/heft-rspack-everything-test/src/indexB.ts b/build-tests/heft-rspack-everything-test/src/indexB.ts new file mode 100644 index 00000000000..2bcd3820a4b --- /dev/null +++ b/build-tests/heft-rspack-everything-test/src/indexB.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +// eslint-disable-next-line no-console +console.log('dostuff'); diff --git a/build-tests/heft-rspack-everything-test/src/test/ExampleTest.test.ts b/build-tests/heft-rspack-everything-test/src/test/ExampleTest.test.ts new file mode 100644 index 00000000000..565432eacf5 --- /dev/null +++ b/build-tests/heft-rspack-everything-test/src/test/ExampleTest.test.ts @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +import { ChunkClass } from '../chunks/ChunkClass'; + +describe('Example Test', () => { + it('Correctly tests stuff', () => { + expect(true).toBeTruthy(); + }); + + it('Correctly handles images', () => { + const chunkClass: ChunkClass = new ChunkClass(); + expect(() => chunkClass.getImageUrl()).not.toThrow(); + expect(typeof chunkClass.getImageUrl()).toBe('string'); + }); +}); diff --git a/build-tests/heft-rspack-everything-test/src/test/Image.test.ts b/build-tests/heft-rspack-everything-test/src/test/Image.test.ts new file mode 100644 index 00000000000..c336d269d60 --- /dev/null +++ b/build-tests/heft-rspack-everything-test/src/test/Image.test.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +import image from '../chunks/image.png'; + +describe('Image Test', () => { + it('correctly handles urls for images', () => { + expect(image).toBe('lib-commonjs/chunks/image.png'); + }); +}); diff --git a/build-tests/heft-rspack-everything-test/src/test/SourceMapTest.test.ts b/build-tests/heft-rspack-everything-test/src/test/SourceMapTest.test.ts new file mode 100644 index 00000000000..52171383838 --- /dev/null +++ b/build-tests/heft-rspack-everything-test/src/test/SourceMapTest.test.ts @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +import { FileSystem, PackageJsonLookup } from '@rushstack/node-core-library'; + +interface IMap { + sources?: string[]; + file?: string; + sourcesContent?: string[]; + names?: string[]; +} + +interface IMapValue { + mapFileName: string; + mapObject: IMap; +} + +interface IMapTestEntry { + name: string; + mapRegex: RegExp; + sourceFileRegex: RegExp; + map: IMapValue | undefined; +} + +const mapTests: IMapTestEntry[] = [ + { + name: 'Test-A', + mapRegex: /^heft-test-A_[\w\d]*\.js.map$/, + sourceFileRegex: /indexA\.ts$/, + map: undefined + }, + { + name: 'Test-B', + mapRegex: /^heft-test-B_[\w\d]*\.js.map$/, + sourceFileRegex: /indexB\.ts$/, + map: undefined + }, + { + name: 'Chunk', + mapRegex: /^[\w\d\.]*chunk_[\w\d]*\.js.map$/, + sourceFileRegex: /ChunkClass\.ts$/, + map: undefined + } +]; + +const lookup: PackageJsonLookup = new PackageJsonLookup(); +lookup.tryGetPackageFolderFor(__dirname); +const thisProjectFolder: string | undefined = lookup.tryGetPackageFolderFor(__dirname); +if (!thisProjectFolder) { + throw new Error('Cannot find project folder'); +} +const distEntries: string[] = FileSystem.readFolderItemNames(thisProjectFolder + '/dist'); +for (const distEntry of distEntries) { + for (const test of mapTests) { + if (test.mapRegex.test(distEntry)) { + const mapText: string = FileSystem.readFile(`${thisProjectFolder}/dist/${distEntry}`); + const mapObject: IMap = JSON.parse(mapText); + test.map = { + mapFileName: distEntry, + mapObject + }; + } + } +} + +describe('Source Maps', () => { + for (const test of mapTests) { + mapValueCheck(test); + } +}); + +function mapValueCheck(entry: IMapTestEntry): void { + it(`${entry.name} has map value`, () => { + expect(entry.map).toBeTruthy(); + }); + + if (!entry.map) { + return; + } + + const map: IMapValue = entry.map; + + it(`${entry.name} has filename matching file attribute`, () => { + if (map.mapObject.file) { + expect(map.mapFileName).toMatch(`${map.mapObject.file}.map`); + } + }); + + const properties: (keyof IMap)[] = ['sources', 'file', 'sourcesContent', 'names']; + for (const property of properties) { + it(`${map.mapFileName} has ${property} property`, () => { + expect(map.mapObject[property]).toBeTruthy(); + }); + } + + it(`${entry.name} has sources and sourcesContent arrays of the same length`, () => { + if (map.mapObject.sourcesContent && map.mapObject.sources) { + let numSrcs: number = 0; + for (const source of map.mapObject.sources) { + if (source) { + numSrcs++; + } + } + + let numContents: number = 0; + for (const content of map.mapObject.sourcesContent) { + if (content) { + numContents++; + } + } + expect(numSrcs).toEqual(numContents); + } + }); + + it(`${entry.name} has a source that matches the sourceFileRegex`, () => { + if (map.mapObject.sources) { + expect(map.mapObject.sources).toContainEqual(expect.stringMatching(entry.sourceFileRegex)); + } + }); +} diff --git a/build-tests/heft-rspack-everything-test/tsconfig.json b/build-tests/heft-rspack-everything-test/tsconfig.json new file mode 100644 index 00000000000..1838fa44b78 --- /dev/null +++ b/build-tests/heft-rspack-everything-test/tsconfig.json @@ -0,0 +1,29 @@ +{ + "$schema": "http://json.schemastore.org/tsconfig", + + "compilerOptions": { + "outDir": "lib", + "rootDir": "src", + + "allowArbitraryExtensions": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "jsx": "react", + "declaration": true, + "sourceMap": true, + "declarationMap": true, + "inlineSources": true, + "experimentalDecorators": true, + "strictNullChecks": true, + "noUnusedLocals": true, + "types": ["heft-jest", "node"], + + "module": "esnext", + "moduleResolution": "node", + "target": "es5", + "lib": ["es5", "scripthost", "es2015.collection", "es2015.promise", "es2015.iterable", "dom"] + }, + "include": ["src/**/*.ts", "src/**/*.tsx"], + "exclude": ["node_modules", "lib"] +} diff --git a/rush.json b/rush.json index 65dc161d4c3..a4f69a6db82 100644 --- a/rush.json +++ b/rush.json @@ -893,6 +893,12 @@ "reviewCategory": "tests", "shouldPublish": false }, + { + "packageName": "heft-rspack-everything-test", + "projectFolder": "build-tests/heft-rspack-everything-test", + "reviewCategory": "tests", + "shouldPublish": false + }, { "packageName": "heft-sass-test", "projectFolder": "build-tests/heft-sass-test", From 366cd8869105679b061f813c4d6b361292a83f8f Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Mon, 6 Oct 2025 21:32:59 -0700 Subject: [PATCH 06/24] rush update --- .../heft-rspack-everything-test/package.json | 2 +- .../rush/nonbrowser-approved-packages.json | 8 + .../config/subspaces/default/pnpm-lock.yaml | 249 +++++++++++++++--- heft-plugins/heft-rspack-plugin/package.json | 2 +- 4 files changed, 221 insertions(+), 40 deletions(-) diff --git a/build-tests/heft-rspack-everything-test/package.json b/build-tests/heft-rspack-everything-test/package.json index 8b59e2b2cf9..6e135a6989f 100644 --- a/build-tests/heft-rspack-everything-test/package.json +++ b/build-tests/heft-rspack-everything-test/package.json @@ -23,7 +23,7 @@ "@rushstack/rush-sdk": "workspace:*", "@types/heft-jest": "1.0.1", "@types/node": "20.17.19", - "eslint": "~9.25.1", + "eslint": "~9.37.0", "local-eslint-config": "workspace:*", "source-map-loader": "~3.0.1", "typescript": "~5.8.2", diff --git a/common/config/rush/nonbrowser-approved-packages.json b/common/config/rush/nonbrowser-approved-packages.json index 52f8402a76c..4e486f0e688 100644 --- a/common/config/rush/nonbrowser-approved-packages.json +++ b/common/config/rush/nonbrowser-approved-packages.json @@ -124,8 +124,16 @@ }, { "name": "@rspack/core", + "allowedCategories": [ "libraries", "tests" ] + }, + { + "name": "@rspack/dev-server", "allowedCategories": [ "libraries" ] }, + { + "name": "@rushstack/heft-rspack-plugin", + "allowedCategories": [ "tests" ] + }, { "name": "@rushstack/debug-certificate-manager", "allowedCategories": [ "libraries", "vscode-extensions" ] diff --git a/common/config/subspaces/default/pnpm-lock.yaml b/common/config/subspaces/default/pnpm-lock.yaml index 812265d7c57..f68de9e467f 100644 --- a/common/config/subspaces/default/pnpm-lock.yaml +++ b/common/config/subspaces/default/pnpm-lock.yaml @@ -1817,6 +1817,60 @@ importers: specifier: ~5.8.2 version: 5.8.2 + ../../../build-tests/heft-rspack-everything-test: + devDependencies: + '@rspack/core': + specifier: ~1.5.8 + version: 1.5.8(webpack-dev-server@5.1.0) + '@rushstack/heft': + specifier: workspace:* + version: link:../../apps/heft + '@rushstack/heft-dev-cert-plugin': + specifier: workspace:* + version: link:../../heft-plugins/heft-dev-cert-plugin + '@rushstack/heft-jest-plugin': + specifier: workspace:* + version: link:../../heft-plugins/heft-jest-plugin + '@rushstack/heft-lint-plugin': + specifier: workspace:* + version: link:../../heft-plugins/heft-lint-plugin + '@rushstack/heft-rspack-plugin': + specifier: workspace:* + version: link:../../heft-plugins/heft-rspack-plugin + '@rushstack/heft-typescript-plugin': + specifier: workspace:* + version: link:../../heft-plugins/heft-typescript-plugin + '@rushstack/node-core-library': + specifier: workspace:* + version: link:../../libraries/node-core-library + '@rushstack/rush-sdk': + specifier: workspace:* + version: link:../../libraries/rush-sdk + '@types/heft-jest': + specifier: 1.0.1 + version: 1.0.1 + '@types/node': + specifier: 20.17.19 + version: 20.17.19 + eslint: + specifier: ~9.37.0 + version: 9.37.0(supports-color@8.1.1) + local-eslint-config: + specifier: workspace:* + version: link:../../eslint/local-eslint-config + source-map-loader: + specifier: ~3.0.1 + version: 3.0.2(webpack@5.98.0) + typescript: + specifier: ~5.8.2 + version: 5.8.2 + webpack: + specifier: ~5.98.0 + version: 5.98.0 + webpack-dev-server: + specifier: ^5.1.0 + version: 5.1.0(webpack@5.98.0) + ../../../build-tests/heft-sass-test: dependencies: buttono: @@ -3021,6 +3075,9 @@ importers: ../../../heft-plugins/heft-rspack-plugin: dependencies: + '@rspack/dev-server': + specifier: ^1.1.4 + version: 1.1.4(@rspack/core@1.5.8)(webpack@5.98.0) '@rushstack/debug-certificate-manager': specifier: workspace:* version: link:../../libraries/debug-certificate-manager @@ -3033,25 +3090,34 @@ importers: tapable: specifier: 1.1.3 version: 1.1.3 - webpack-dev-server: - specifier: ^5.1.0 - version: 5.1.0(webpack@5.98.0) + watchpack: + specifier: 2.4.0 + version: 2.4.0 devDependencies: '@rspack/core': - specifier: ^1.2.8 - version: 1.5.8 - '@rushstack/eslint-config': - specifier: workspace:* - version: link:../../eslint/eslint-config + specifier: ~1.5.8 + version: 1.5.8(webpack-dev-server@5.1.0) '@rushstack/heft': specifier: workspace:* version: link:../../apps/heft - '@rushstack/heft-node-rig': + '@rushstack/terminal': specifier: workspace:* - version: link:../../rigs/heft-node-rig - '@types/node': - specifier: 20.17.19 - version: 20.17.19 + version: link:../../libraries/terminal + '@types/watchpack': + specifier: 2.4.0 + version: 2.4.0 + eslint: + specifier: ~9.37.0 + version: 9.37.0(supports-color@8.1.1) + local-node-rig: + specifier: workspace:* + version: link:../../rigs/local-node-rig + webpack: + specifier: ~5.98.0 + version: 5.98.0 + webpack-dev-server: + specifier: ^5.1.0 + version: 5.1.0(webpack@5.98.0) ../../../heft-plugins/heft-sass-load-themed-styles-plugin: dependencies: @@ -7679,7 +7745,6 @@ packages: dependencies: '@emnapi/wasi-threads': 1.1.0 tslib: 2.8.1 - dev: true optional: true /@emnapi/runtime@1.5.0: @@ -7687,7 +7752,6 @@ packages: requiresBuild: true dependencies: tslib: 2.8.1 - dev: true optional: true /@emnapi/wasi-threads@1.1.0: @@ -7695,7 +7759,6 @@ packages: requiresBuild: true dependencies: tslib: 2.8.1 - dev: true optional: true /@emotion/cache@10.0.29: @@ -10476,21 +10539,18 @@ packages: /@module-federation/error-codes@0.18.0: resolution: {integrity: sha512-Woonm8ehyVIUPXChmbu80Zj6uJkC0dD9SJUZ/wOPtO8iiz/m+dkrOugAuKgoiR6qH4F+yorWila954tBz4uKsQ==} - dev: true /@module-federation/runtime-core@0.18.0: resolution: {integrity: sha512-ZyYhrDyVAhUzriOsVfgL6vwd+5ebYm595Y13KeMf6TKDRoUHBMTLGQ8WM4TDj8JNsy7LigncK8C03fn97of0QQ==} dependencies: '@module-federation/error-codes': 0.18.0 '@module-federation/sdk': 0.18.0 - dev: true /@module-federation/runtime-tools@0.18.0: resolution: {integrity: sha512-fSga9o4t1UfXNV/Kh6qFvRyZpPp3EHSPRISNeyT8ZoTpzDNiYzhtw0BPUSSD8m6C6XQh2s/11rI4g80UY+d+hA==} dependencies: '@module-federation/runtime': 0.18.0 '@module-federation/webpack-bundler-runtime': 0.18.0 - dev: true /@module-federation/runtime@0.18.0: resolution: {integrity: sha512-+C4YtoSztM7nHwNyZl6dQKGUVJdsPrUdaf3HIKReg/GQbrt9uvOlUWo2NXMZ8vDAnf/QRrpSYAwXHmWDn9Obaw==} @@ -10498,18 +10558,15 @@ packages: '@module-federation/error-codes': 0.18.0 '@module-federation/runtime-core': 0.18.0 '@module-federation/sdk': 0.18.0 - dev: true /@module-federation/sdk@0.18.0: resolution: {integrity: sha512-Lo/Feq73tO2unjmpRfyyoUkTVoejhItXOk/h5C+4cistnHbTV8XHrW/13fD5e1Iu60heVdAhhelJd6F898Ve9A==} - dev: true /@module-federation/webpack-bundler-runtime@0.18.0: resolution: {integrity: sha512-TEvErbF+YQ+6IFimhUYKK3a5wapD90d90sLsNpcu2kB3QGT7t4nIluE25duXuZDVUKLz86tEPrza/oaaCWTpvQ==} dependencies: '@module-federation/runtime': 0.18.0 '@module-federation/sdk': 0.18.0 - dev: true /@mrmlnc/readdir-enhanced@2.2.1: resolution: {integrity: sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==} @@ -10526,7 +10583,6 @@ packages: '@emnapi/core': 1.5.0 '@emnapi/runtime': 1.5.0 '@tybys/wasm-util': 0.10.1 - dev: true optional: true /@nodelib/fs.scandir@2.1.5: @@ -11257,7 +11313,6 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true - dev: true optional: true /@rspack/binding-darwin-x64@1.5.8: @@ -11265,7 +11320,6 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true - dev: true optional: true /@rspack/binding-linux-arm64-gnu@1.5.8: @@ -11273,7 +11327,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@rspack/binding-linux-arm64-musl@1.5.8: @@ -11281,7 +11334,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@rspack/binding-linux-x64-gnu@1.5.8: @@ -11289,7 +11341,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@rspack/binding-linux-x64-musl@1.5.8: @@ -11297,7 +11348,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@rspack/binding-wasm32-wasi@1.5.8: @@ -11306,7 +11356,6 @@ packages: requiresBuild: true dependencies: '@napi-rs/wasm-runtime': 1.0.6 - dev: true optional: true /@rspack/binding-win32-arm64-msvc@1.5.8: @@ -11314,7 +11363,6 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true - dev: true optional: true /@rspack/binding-win32-ia32-msvc@1.5.8: @@ -11322,7 +11370,6 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true - dev: true optional: true /@rspack/binding-win32-x64-msvc@1.5.8: @@ -11330,7 +11377,6 @@ packages: cpu: [x64] os: [win32] requiresBuild: true - dev: true optional: true /@rspack/binding@1.5.8: @@ -11346,9 +11392,8 @@ packages: '@rspack/binding-win32-arm64-msvc': 1.5.8 '@rspack/binding-win32-ia32-msvc': 1.5.8 '@rspack/binding-win32-x64-msvc': 1.5.8 - dev: true - /@rspack/core@1.5.8: + /@rspack/core@1.5.8(webpack-dev-server@5.1.0): resolution: {integrity: sha512-sUd2LfiDhqYVfvknuoz0+/c+wSpn693xotnG5g1CSWKZArbtwiYzBIVnNlcHGmuoBRsnj/TkSq8dTQ7gwfBroQ==} engines: {node: '>=18.12.0'} peerDependencies: @@ -11361,12 +11406,33 @@ packages: '@module-federation/runtime-tools': 0.18.0 '@rspack/binding': 1.5.8 '@rspack/lite-tapable': 1.0.1 - dev: true + webpack-dev-server: 5.1.0(webpack@5.98.0) + + /@rspack/dev-server@1.1.4(@rspack/core@1.5.8)(webpack@5.98.0): + resolution: {integrity: sha512-kGHYX2jYf3ZiHwVl0aUEPBOBEIG1aWleCDCAi+Jg32KUu3qr/zDUpCEd0wPuHfLEgk0X0xAEYCS6JMO7nBStNQ==} + engines: {node: '>= 18.12.0'} + peerDependencies: + '@rspack/core': '*' + dependencies: + '@rspack/core': 1.5.8(webpack-dev-server@5.1.0) + chokidar: 3.6.0 + http-proxy-middleware: 2.0.9 + p-retry: 6.2.0 + webpack-dev-server: 5.2.2(webpack@5.98.0) + ws: 8.18.0 + transitivePeerDependencies: + - '@types/webpack' + - bufferutil + - debug + - supports-color + - utf-8-validate + - webpack + - webpack-cli + dev: false /@rspack/lite-tapable@1.0.1: resolution: {integrity: sha512-VynGOEsVw2s8TAlLf/uESfrgfrq2+rcXB1muPJYBWbsm1Oa6r5qVQhjA5ggM6z/coYPrsVMgovl3Ff7Q7OCp1w==} engines: {node: '>=16.0.0'} - dev: true /@rtsao/scc@1.1.0: resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==} @@ -13996,7 +14062,6 @@ packages: requiresBuild: true dependencies: tslib: 2.8.1 - dev: true optional: true /@types/argparse@1.0.38: @@ -20709,6 +20774,43 @@ packages: utils-merge: 1.0.1 vary: 1.1.2 + /express@4.21.2: + resolution: {integrity: sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==} + engines: {node: '>= 0.10.0'} + dependencies: + accepts: 1.3.8 + array-flatten: 1.1.1 + body-parser: 1.20.3 + content-disposition: 0.5.4 + content-type: 1.0.5 + cookie: 0.7.1 + cookie-signature: 1.0.6 + debug: 2.6.9 + depd: 2.0.0 + encodeurl: 2.0.0 + escape-html: 1.0.3 + etag: 1.8.1 + finalhandler: 1.3.1 + fresh: 0.5.2 + http-errors: 2.0.0 + merge-descriptors: 1.0.3 + methods: 1.1.2 + on-finished: 2.4.1 + parseurl: 1.3.3 + path-to-regexp: 0.1.12 + proxy-addr: 2.0.7 + qs: 6.13.0 + range-parser: 1.2.1 + safe-buffer: 5.2.1 + send: 0.19.0 + serve-static: 1.16.2 + setprototypeof: 1.2.0 + statuses: 2.0.1 + type-is: 1.6.18 + utils-merge: 1.0.1 + vary: 1.1.2 + dev: false + /express@5.1.0: resolution: {integrity: sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==} engines: {node: '>= 18'} @@ -22252,6 +22354,20 @@ packages: transitivePeerDependencies: - debug + /http-proxy-middleware@2.0.9: + resolution: {integrity: sha512-c1IyJYLYppU574+YI7R4QyX2ystMtVXZwIdzazUIPIJsHuWNd+mho2j+bKoHftndicGj9yh+xjd+l0yj7VeT1Q==} + engines: {node: '>=12.0.0'} + dependencies: + '@types/express': 4.17.21 + '@types/http-proxy': 1.17.14 + http-proxy: 1.18.1 + is-glob: 4.0.3 + is-plain-obj: 3.0.0 + micromatch: 4.0.5 + transitivePeerDependencies: + - debug + dev: false + /http-proxy@1.18.1: resolution: {integrity: sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==} engines: {node: '>=8.0.0'} @@ -25979,6 +26095,10 @@ packages: /path-to-regexp@0.1.10: resolution: {integrity: sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==} + /path-to-regexp@0.1.12: + resolution: {integrity: sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==} + dev: false + /path-to-regexp@8.2.0: resolution: {integrity: sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==} engines: {node: '>=16'} @@ -30826,6 +30946,59 @@ packages: - supports-color - utf-8-validate + /webpack-dev-server@5.2.2(webpack@5.98.0): + resolution: {integrity: sha512-QcQ72gh8a+7JO63TAx/6XZf/CWhgMzu5m0QirvPfGvptOusAxG12w2+aua1Jkjr7hzaWDnJ2n6JFeexMHI+Zjg==} + engines: {node: '>= 18.12.0'} + hasBin: true + peerDependencies: + '@types/webpack': ^4 + webpack: ^5.0.0 || ^4 || ^5 + webpack-cli: '*' + peerDependenciesMeta: + '@types/webpack': + optional: true + webpack: + optional: true + webpack-cli: + optional: true + dependencies: + '@types/bonjour': 3.5.13 + '@types/connect-history-api-fallback': 1.5.4 + '@types/express': 4.17.21 + '@types/express-serve-static-core': 4.17.43 + '@types/serve-index': 1.9.4 + '@types/serve-static': 1.15.5 + '@types/sockjs': 0.3.36 + '@types/ws': 8.5.12 + ansi-html-community: 0.0.8 + anymatch: 3.1.3 + bonjour-service: 1.2.1 + chokidar: 3.6.0 + colorette: 2.0.20 + compression: 1.7.4 + connect-history-api-fallback: 2.0.0 + express: 4.21.2 + graceful-fs: 4.2.11 + http-proxy-middleware: 2.0.9 + ipaddr.js: 2.1.0 + launch-editor: 2.9.1 + open: 10.1.0 + p-retry: 6.2.0 + schema-utils: 4.3.0 + selfsigned: 2.4.1 + serve-index: 1.9.1 + sockjs: 0.3.24 + spdy: 4.0.2 + webpack: 5.98.0 + webpack-dev-middleware: 7.4.2(webpack@5.98.0) + ws: 8.18.0 + transitivePeerDependencies: + - bufferutil + - debug + - supports-color + - utf-8-validate + dev: false + /webpack-filter-warnings-plugin@1.2.1(webpack@4.47.0): resolution: {integrity: sha512-Ez6ytc9IseDMLPo0qCuNNYzgtUl8NovOqjIq4uAU8LTD4uoa1w1KpZyyzFtLTEMZpkkOkLfL9eN+KGYdk1Qtwg==} engines: {node: '>= 4.3 < 5.0.0 || >= 5.10'} diff --git a/heft-plugins/heft-rspack-plugin/package.json b/heft-plugins/heft-rspack-plugin/package.json index f579bef8954..1cba01f2122 100644 --- a/heft-plugins/heft-rspack-plugin/package.json +++ b/heft-plugins/heft-rspack-plugin/package.json @@ -33,7 +33,7 @@ "@rushstack/heft": "workspace:*", "@rushstack/terminal": "workspace:*", "@types/watchpack": "2.4.0", - "eslint": "~9.25.1", + "eslint": "~9.37.0", "local-node-rig": "workspace:*", "@rspack/core": "~1.5.8", "webpack": "~5.98.0", From fa6ad201d7923f9c942432a2b7a9962ab388d687 Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Mon, 6 Oct 2025 21:34:22 -0700 Subject: [PATCH 07/24] rush change --- .../rspack-plugin_2025-10-07-04-34.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@rushstack/heft-webpack5-plugin/rspack-plugin_2025-10-07-04-34.json diff --git a/common/changes/@rushstack/heft-webpack5-plugin/rspack-plugin_2025-10-07-04-34.json b/common/changes/@rushstack/heft-webpack5-plugin/rspack-plugin_2025-10-07-04-34.json new file mode 100644 index 00000000000..e62ded6bf1b --- /dev/null +++ b/common/changes/@rushstack/heft-webpack5-plugin/rspack-plugin_2025-10-07-04-34.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@rushstack/heft-webpack5-plugin", + "comment": "", + "type": "none" + } + ], + "packageName": "@rushstack/heft-webpack5-plugin" +} \ No newline at end of file From b6ec335a585cf5cf02961b69479a897bd0f2865f Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Mon, 6 Oct 2025 22:08:48 -0700 Subject: [PATCH 08/24] add support for ipv6 dev server address --- .../heft-rspack-plugin/src/RspackPlugin.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts index c55ae5f267d..656749d9a7a 100644 --- a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts +++ b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts @@ -261,9 +261,17 @@ export default class RspackPlugin implements IHeftTaskPlugin { const addressInfo: AddressInfo | string | undefined = server.server?.address() as AddressInfo; if (addressInfo) { - const address: string = - typeof addressInfo === 'string' ? addressInfo : `${addressInfo.address}:${addressInfo.port}`; - taskSession.logger.terminal.writeLine(`Started Rspack Dev Server at https://${address}`); + let url: string; + if (typeof addressInfo === 'string') { + url = addressInfo; + } else { + const address: string = + addressInfo.family === 'IPv6' + ? `[${addressInfo.address}]:${addressInfo.port}` + : `${addressInfo.address}:${addressInfo.port}`; + url = `https://${address}/`; + } + taskSession.logger.terminal.writeLine(`Started Rspack Dev Server at ${url}`); } } }; From c5fe1441537b77c9f8074894cd6315b252eadba5 Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Mon, 6 Oct 2025 22:19:38 -0700 Subject: [PATCH 09/24] cleanup @rspack/core package extension --- .../heft-rspack-everything-test/package.json | 3 +- common/config/rush/pnpm-config.json | 6 -- .../build-tests-subspace/pnpm-lock.yaml | 2 +- .../config/subspaces/default/pnpm-lock.yaml | 74 +++++++++++++++---- heft-plugins/heft-rspack-plugin/package.json | 3 +- 5 files changed, 64 insertions(+), 24 deletions(-) diff --git a/build-tests/heft-rspack-everything-test/package.json b/build-tests/heft-rspack-everything-test/package.json index 6e135a6989f..65e7727a630 100644 --- a/build-tests/heft-rspack-everything-test/package.json +++ b/build-tests/heft-rspack-everything-test/package.json @@ -28,7 +28,6 @@ "source-map-loader": "~3.0.1", "typescript": "~5.8.2", "@rspack/core": "~1.5.8", - "webpack": "~5.98.0", - "webpack-dev-server": "^5.1.0" + "webpack": "~5.98.0" } } \ No newline at end of file diff --git a/common/config/rush/pnpm-config.json b/common/config/rush/pnpm-config.json index 228750b5ff7..02f9faa2a00 100644 --- a/common/config/rush/pnpm-config.json +++ b/common/config/rush/pnpm-config.json @@ -418,12 +418,6 @@ "optional": true } } - }, - - "@rspack/core": { - "peerDependencies": { - "webpack-dev-server": "^5.0.4" - } } }, diff --git a/common/config/subspaces/build-tests-subspace/pnpm-lock.yaml b/common/config/subspaces/build-tests-subspace/pnpm-lock.yaml index c95727e775b..18d149cd86b 100644 --- a/common/config/subspaces/build-tests-subspace/pnpm-lock.yaml +++ b/common/config/subspaces/build-tests-subspace/pnpm-lock.yaml @@ -13,7 +13,7 @@ overrides: '@rushstack/eslint-plugin@0.20.0>@typescript-eslint/utils': ~8.46.0 '@rushstack/heft-node-rig@2.10.1>eslint': ~9.37.0 -packageExtensionsChecksum: 52f2427ae44b3da2019a3be8c1ee40b0 +packageExtensionsChecksum: e59cfa9a35183eeeb6f2ac48c9ddd4b2 importers: diff --git a/common/config/subspaces/default/pnpm-lock.yaml b/common/config/subspaces/default/pnpm-lock.yaml index f68de9e467f..e84b2934035 100644 --- a/common/config/subspaces/default/pnpm-lock.yaml +++ b/common/config/subspaces/default/pnpm-lock.yaml @@ -13,7 +13,7 @@ overrides: '@rushstack/eslint-plugin@0.20.0>@typescript-eslint/utils': ~8.46.0 '@rushstack/heft-node-rig@2.10.1>eslint': ~9.37.0 -packageExtensionsChecksum: 52f2427ae44b3da2019a3be8c1ee40b0 +packageExtensionsChecksum: e59cfa9a35183eeeb6f2ac48c9ddd4b2 importers: @@ -1821,7 +1821,7 @@ importers: devDependencies: '@rspack/core': specifier: ~1.5.8 - version: 1.5.8(webpack-dev-server@5.1.0) + version: 1.5.8 '@rushstack/heft': specifier: workspace:* version: link:../../apps/heft @@ -1867,9 +1867,6 @@ importers: webpack: specifier: ~5.98.0 version: 5.98.0 - webpack-dev-server: - specifier: ^5.1.0 - version: 5.1.0(webpack@5.98.0) ../../../build-tests/heft-sass-test: dependencies: @@ -3096,7 +3093,7 @@ importers: devDependencies: '@rspack/core': specifier: ~1.5.8 - version: 1.5.8(webpack-dev-server@5.1.0) + version: 1.5.8 '@rushstack/heft': specifier: workspace:* version: link:../../apps/heft @@ -3115,9 +3112,6 @@ importers: webpack: specifier: ~5.98.0 version: 5.98.0 - webpack-dev-server: - specifier: ^5.1.0 - version: 5.1.0(webpack@5.98.0) ../../../heft-plugins/heft-sass-load-themed-styles-plugin: dependencies: @@ -10406,6 +10400,7 @@ packages: /@leichtgewicht/ip-codec@2.0.4: resolution: {integrity: sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==} + dev: false /@mdx-js/loader@1.6.22(react@17.0.2): resolution: {integrity: sha512-9CjGwy595NaxAYp0hF9B/A0lH6C8Rms97e2JS9d3jVUtILn6pT5i5IV965ra3lIWc7Rs1GG1tBdVF7dCowYe6Q==} @@ -11393,12 +11388,11 @@ packages: '@rspack/binding-win32-ia32-msvc': 1.5.8 '@rspack/binding-win32-x64-msvc': 1.5.8 - /@rspack/core@1.5.8(webpack-dev-server@5.1.0): + /@rspack/core@1.5.8: resolution: {integrity: sha512-sUd2LfiDhqYVfvknuoz0+/c+wSpn693xotnG5g1CSWKZArbtwiYzBIVnNlcHGmuoBRsnj/TkSq8dTQ7gwfBroQ==} engines: {node: '>=18.12.0'} peerDependencies: '@swc/helpers': '>=0.5.1' - webpack-dev-server: ^5.0.4 peerDependenciesMeta: '@swc/helpers': optional: true @@ -11406,7 +11400,6 @@ packages: '@module-federation/runtime-tools': 0.18.0 '@rspack/binding': 1.5.8 '@rspack/lite-tapable': 1.0.1 - webpack-dev-server: 5.1.0(webpack@5.98.0) /@rspack/dev-server@1.1.4(@rspack/core@1.5.8)(webpack@5.98.0): resolution: {integrity: sha512-kGHYX2jYf3ZiHwVl0aUEPBOBEIG1aWleCDCAi+Jg32KUu3qr/zDUpCEd0wPuHfLEgk0X0xAEYCS6JMO7nBStNQ==} @@ -11414,7 +11407,7 @@ packages: peerDependencies: '@rspack/core': '*' dependencies: - '@rspack/core': 1.5.8(webpack-dev-server@5.1.0) + '@rspack/core': 1.5.8 chokidar: 3.6.0 http-proxy-middleware: 2.0.9 p-retry: 6.2.0 @@ -14106,6 +14099,7 @@ packages: resolution: {integrity: sha512-z9fJ5Im06zvUL548KvYNecEVlA7cVDkGUi6kZusb04mpyEFKCIZJvloCcmpmLaIahDpOQGHaHmG6imtPMmPXGQ==} dependencies: '@types/node': 17.0.41 + dev: false /@types/cacheable-request@6.0.3: resolution: {integrity: sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==} @@ -14146,6 +14140,7 @@ packages: dependencies: '@types/express-serve-static-core': 4.17.43 '@types/node': 17.0.41 + dev: false /@types/connect@3.4.38: resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} @@ -14408,6 +14403,7 @@ packages: resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==} dependencies: '@types/node': 17.0.41 + dev: false /@types/node@14.0.1: resolution: {integrity: sha512-FAYBGwC+W6F9+huFIDtn43cpy7+SzG+atzRiTfdp3inUKL2hXnd4rG8hylJLIh4+hqrQy1P17kvJByE/z825hA==} @@ -14529,6 +14525,7 @@ packages: /@types/retry@0.12.2: resolution: {integrity: sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==} + dev: false /@types/scheduler@0.16.8: resolution: {integrity: sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==} @@ -14550,6 +14547,7 @@ packages: resolution: {integrity: sha512-qLpGZ/c2fhSs5gnYsQxtDEq3Oy8SXPClIXkW5ghvAvsNuVSA8k+gCONcUCS/UjLEYvYps+e8uBtfgXgvhwfNug==} dependencies: '@types/express': 4.17.21 + dev: false /@types/serve-static@1.15.5: resolution: {integrity: sha512-PDRk21MnK70hja/YF8AHfC7yIsiQHn1rcXx7ijCFBX/k+XQJhQT/gw3xekXKJvx+5SXaMMS8oqQy09Mzvz2TuQ==} @@ -14562,6 +14560,7 @@ packages: resolution: {integrity: sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q==} dependencies: '@types/node': 17.0.41 + dev: false /@types/source-list-map@0.1.6: resolution: {integrity: sha512-5JcVt1u5HDmlXkwOD2nslZVllBBc7HDuOICfiZah2Z0is8M8g+ddAEawbmd3VjedfDHBzxCaXLs07QEmb7y54g==} @@ -14661,6 +14660,7 @@ packages: resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==} dependencies: '@types/node': 17.0.41 + dev: false /@types/ws@8.5.5: resolution: {integrity: sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==} @@ -16880,6 +16880,7 @@ packages: /batch@0.6.1: resolution: {integrity: sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==} + dev: false /better-opn@2.1.1: resolution: {integrity: sha512-kIPXZS5qwyKiX/HcRvDYfmBQUa8XP17I0mYZZ0y4UhpYOSvtsLHDYqmomS+Mj20aDvD3knEiQ0ecQy2nhio3yA==} @@ -17011,6 +17012,7 @@ packages: dependencies: fast-deep-equal: 3.1.3 multicast-dns: 7.2.5 + dev: false /boolbase@1.0.0: resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==} @@ -17224,6 +17226,7 @@ packages: engines: {node: '>=18'} dependencies: run-applescript: 7.0.0 + dev: false /buttono@1.0.4: resolution: {integrity: sha512-aLOeyK3zrhZnqvH6LzwIbjur8mkKhW8Xl3/jolX+RCJnGG354+L48q1SJWdky89uhQ/mBlTxY/d0x8+ciE0ZWw==} @@ -17825,6 +17828,7 @@ packages: /colorette@2.0.20: resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} + dev: false /colorjs.io@0.5.2: resolution: {integrity: sha512-twmVoizEW7ylZSN32OgKdXRmo1qg+wT5/6C3xu5b9QsWzSFAhHLn2xd8ro0diCsKfCj1RdaTP/nrcW+vAoQPIw==} @@ -17968,6 +17972,7 @@ packages: /connect-history-api-fallback@2.0.0: resolution: {integrity: sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==} engines: {node: '>=0.8'} + dev: false /console-browserify@1.2.0: resolution: {integrity: sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==} @@ -18612,6 +18617,7 @@ packages: /default-browser-id@5.0.0: resolution: {integrity: sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==} engines: {node: '>=18'} + dev: false /default-browser@5.2.1: resolution: {integrity: sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==} @@ -18619,6 +18625,7 @@ packages: dependencies: bundle-name: 4.1.0 default-browser-id: 5.0.0 + dev: false /default-gateway@6.0.3: resolution: {integrity: sha512-fwSOJsbbNzZ/CUFpqFBqYfYNLj1NbMPm8MMCIzHjC83iSJRBEGmDUxU+WP661BaBQImeC2yHwXtz+P/O9o+XEg==} @@ -18653,6 +18660,7 @@ packages: /define-lazy-prop@3.0.0: resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==} engines: {node: '>=12'} + dev: false /define-properties@1.2.1: resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} @@ -18733,6 +18741,7 @@ packages: /depd@1.1.2: resolution: {integrity: sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==} engines: {node: '>= 0.6'} + dev: false /depd@2.0.0: resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} @@ -18795,6 +18804,7 @@ packages: /detect-node@2.1.0: resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==} + dev: false /detect-port-alt@1.1.6: resolution: {integrity: sha512-5tQykt+LqfJFBEYaDITx7S7cR7mJ/zQmLXZ2qt5w04ainYZw6tBf9dBunMjVeVOdYVRUzUOE4HkY5J7+uttb5Q==} @@ -18864,6 +18874,7 @@ packages: engines: {node: '>=6'} dependencies: '@leichtgewicht/ip-codec': 2.0.4 + dev: false /doctrine@2.1.0: resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==} @@ -21015,6 +21026,7 @@ packages: engines: {node: '>=0.8.0'} dependencies: websocket-driver: 0.7.4 + dev: false /fb-watchman@2.0.2: resolution: {integrity: sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==} @@ -21928,6 +21940,7 @@ packages: /handle-thing@2.0.1: resolution: {integrity: sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==} + dev: false /handlebars@4.7.8: resolution: {integrity: sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==} @@ -22176,6 +22189,7 @@ packages: obuf: 1.1.2 readable-stream: 2.3.8 wbuf: 1.7.3 + dev: false /html-encoding-sniffer@3.0.0: resolution: {integrity: sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==} @@ -22276,6 +22290,7 @@ packages: /http-deceiver@1.2.7: resolution: {integrity: sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw==} + dev: false /http-errors@1.6.3: resolution: {integrity: sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==} @@ -22285,6 +22300,7 @@ packages: inherits: 2.0.3 setprototypeof: 1.1.0 statuses: 1.5.0 + dev: false /http-errors@1.8.1: resolution: {integrity: sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==} @@ -22309,6 +22325,7 @@ packages: /http-parser-js@0.5.8: resolution: {integrity: sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q==} + dev: false /http-proxy-agent@4.0.1: resolution: {integrity: sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==} @@ -22353,6 +22370,7 @@ packages: micromatch: 4.0.5 transitivePeerDependencies: - debug + dev: false /http-proxy-middleware@2.0.9: resolution: {integrity: sha512-c1IyJYLYppU574+YI7R4QyX2ystMtVXZwIdzazUIPIJsHuWNd+mho2j+bKoHftndicGj9yh+xjd+l0yj7VeT1Q==} @@ -22678,6 +22696,7 @@ packages: /ipaddr.js@2.1.0: resolution: {integrity: sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ==} engines: {node: '>= 10'} + dev: false /is-absolute-url@3.0.3: resolution: {integrity: sha512-opmNIX7uFnS96NtPmhWQgQx6/NYFgsUXYMllcfzwWKUMwfo8kku1TvE6hkNcH+Q1ts5cMVrsY7j0bxXQDciu9Q==} @@ -22849,6 +22868,7 @@ packages: resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} hasBin: true + dev: false /is-dom@1.1.0: resolution: {integrity: sha512-u82f6mvhYxRPKpw8V1N0W8ce1xXwOrQtgGcxl6UCL5zBmZu3is/18K0rR7uFCnMDuAsS/3W54mGL4vsaFUQlEQ==} @@ -22933,6 +22953,7 @@ packages: hasBin: true dependencies: is-docker: 3.0.0 + dev: false /is-installed-globally@0.4.0: resolution: {integrity: sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==} @@ -22961,6 +22982,7 @@ packages: /is-network-error@1.1.0: resolution: {integrity: sha512-tUdRRAnhT+OtCZR/LxZelH/C7QtjtFrTu5tXCA8pl55eTUElUHT+GPYV8MBMBvea/j+NxQqVt3LbWMRir7Gx9g==} engines: {node: '>=16'} + dev: false /is-npm@5.0.0: resolution: {integrity: sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==} @@ -23007,6 +23029,7 @@ packages: /is-plain-obj@3.0.0: resolution: {integrity: sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==} engines: {node: '>=10'} + dev: false /is-plain-object@2.0.4: resolution: {integrity: sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==} @@ -23173,6 +23196,7 @@ packages: engines: {node: '>=16'} dependencies: is-inside-container: 1.0.0 + dev: false /is-yarn-global@0.3.0: resolution: {integrity: sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==} @@ -24360,6 +24384,7 @@ packages: dependencies: picocolors: 1.0.0 shell-quote: 1.8.1 + dev: false /lazy-universal-dotenv@3.0.1: resolution: {integrity: sha512-prXSYk799h3GY3iOWnC6ZigYzMPjxN2svgjJ9shk7oMadSNX3wXy0B6F32PMJv7qtMnrIbUxoEHzbutvxR2LBQ==} @@ -25220,6 +25245,7 @@ packages: dependencies: dns-packet: 5.6.1 thunky: 1.1.0 + dev: false /multimatch@5.0.0: resolution: {integrity: sha512-ypMKuglUrZUD99Tk2bUQ+xNQj43lPEfAeX2o9cTteAmShXy2VHDJpuwu1o0xqoKCt9jLVAvwyFKdLTPXKAfJyA==} @@ -25364,6 +25390,7 @@ packages: /node-forge@1.3.1: resolution: {integrity: sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==} engines: {node: '>= 6.13.0'} + dev: false /node-gyp@8.1.0: resolution: {integrity: sha512-o2elh1qt7YUp3lkMwY3/l4KF3j/A3fI/Qt4NH+CQQgPJdqGE9y7qnP84cjIWN27Q0jJkrSAhCVDg+wBVNBYdBg==} @@ -25695,6 +25722,7 @@ packages: /obuf@1.1.2: resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==} + dev: false /on-finished@2.3.0: resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==} @@ -25732,6 +25760,7 @@ packages: define-lazy-prop: 3.0.0 is-inside-container: 1.0.0 is-wsl: 3.1.0 + dev: false /open@7.4.2: resolution: {integrity: sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==} @@ -25916,6 +25945,7 @@ packages: '@types/retry': 0.12.2 is-network-error: 1.1.0 retry: 0.13.1 + dev: false /p-settle@4.1.1: resolution: {integrity: sha512-6THGh13mt3gypcNMm0ADqVNCcYa3BK6DWsuJWFCuEKP1rpY+OKGp7gaZwVmLspmic01+fsg/fN57MfvDzZ/PuQ==} @@ -27918,6 +27948,7 @@ packages: /run-applescript@7.0.0: resolution: {integrity: sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==} engines: {node: '>=18'} + dev: false /run-async@2.4.1: resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==} @@ -28345,6 +28376,7 @@ packages: ajv: 8.13.0 ajv-formats: 2.1.1 ajv-keywords: 5.1.0(ajv@8.13.0) + dev: false /schema-utils@4.3.0: resolution: {integrity: sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==} @@ -28361,6 +28393,7 @@ packages: /select-hose@2.0.0: resolution: {integrity: sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==} + dev: false /selfsigned@2.4.1: resolution: {integrity: sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==} @@ -28368,6 +28401,7 @@ packages: dependencies: '@types/node-forge': 1.3.11 node-forge: 1.3.1 + dev: false /semver-compare@1.0.0: resolution: {integrity: sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==} @@ -28503,6 +28537,7 @@ packages: http-errors: 1.6.3 mime-types: 2.1.35 parseurl: 1.3.3 + dev: false /serve-static@1.16.2: resolution: {integrity: sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==} @@ -28580,6 +28615,7 @@ packages: /setprototypeof@1.1.0: resolution: {integrity: sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==} + dev: false /setprototypeof@1.2.0: resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} @@ -28625,6 +28661,7 @@ packages: /shell-quote@1.8.1: resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==} + dev: false /shelljs@0.8.5: resolution: {integrity: sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==} @@ -28783,6 +28820,7 @@ packages: faye-websocket: 0.11.4 uuid: 8.3.2 websocket-driver: 0.7.4 + dev: false /socks-proxy-agent@5.0.1: resolution: {integrity: sha512-vZdmnjb9a2Tz6WEQVIurybSwElwPxMZaIc7PzqbJTrezcKNznv6giT7J7tZDZ1BojVaa1jvO/UiUdhDVB0ACoQ==} @@ -28928,6 +28966,7 @@ packages: wbuf: 1.7.3 transitivePeerDependencies: - supports-color + dev: false /spdy@4.0.2: resolution: {integrity: sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==} @@ -28940,6 +28979,7 @@ packages: spdy-transport: 3.0.0 transitivePeerDependencies: - supports-color + dev: false /split-string@3.1.0: resolution: {integrity: sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==} @@ -29005,6 +29045,7 @@ packages: /statuses@1.5.0: resolution: {integrity: sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==} engines: {node: '>= 0.6'} + dev: false /statuses@2.0.1: resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==} @@ -29678,6 +29719,7 @@ packages: /thunky@1.1.0: resolution: {integrity: sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==} + dev: false /timers-browserify@2.0.12: resolution: {integrity: sha512-9phl76Cqm6FhSX9Xe1ZUAMLtm1BLkKj2Qd5ApyWkXzsMRaA7dgr81kf4wJmQf/hAvg8EEyJxDo3du/0KlhPiKQ==} @@ -30744,6 +30786,7 @@ packages: resolution: {integrity: sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==} dependencies: minimalistic-assert: 1.0.1 + dev: false /wcwidth@1.0.1: resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} @@ -30838,6 +30881,7 @@ packages: range-parser: 1.2.1 schema-utils: 4.2.0 webpack: 5.98.0 + dev: false /webpack-dev-server@4.9.3(@types/webpack@4.41.32)(webpack@4.47.0): resolution: {integrity: sha512-3qp/eoboZG5/6QgiZ3llN8TUzkSpYg1Ko9khWX1h40MIEUNS2mDoIa8aXsPfskER+GbTvs/IJZ1QTBBhhuetSw==} @@ -30945,6 +30989,7 @@ packages: - debug - supports-color - utf-8-validate + dev: false /webpack-dev-server@5.2.2(webpack@5.98.0): resolution: {integrity: sha512-QcQ72gh8a+7JO63TAx/6XZf/CWhgMzu5m0QirvPfGvptOusAxG12w2+aua1Jkjr7hzaWDnJ2n6JFeexMHI+Zjg==} @@ -31129,10 +31174,12 @@ packages: http-parser-js: 0.5.8 safe-buffer: 5.2.1 websocket-extensions: 0.1.4 + dev: false /websocket-extensions@0.1.4: resolution: {integrity: sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==} engines: {node: '>=0.8.0'} + dev: false /whatwg-encoding@2.0.0: resolution: {integrity: sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==} @@ -31402,6 +31449,7 @@ packages: optional: true utf-8-validate: optional: true + dev: false /xdg-basedir@4.0.0: resolution: {integrity: sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==} diff --git a/heft-plugins/heft-rspack-plugin/package.json b/heft-plugins/heft-rspack-plugin/package.json index 1cba01f2122..b19d8aa1af2 100644 --- a/heft-plugins/heft-rspack-plugin/package.json +++ b/heft-plugins/heft-rspack-plugin/package.json @@ -36,7 +36,6 @@ "eslint": "~9.37.0", "local-node-rig": "workspace:*", "@rspack/core": "~1.5.8", - "webpack": "~5.98.0", - "webpack-dev-server": "^5.1.0" + "webpack": "~5.98.0" } } \ No newline at end of file From b0799945ae370604e9faec45118215f94d95f800 Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Mon, 6 Oct 2025 22:20:06 -0700 Subject: [PATCH 10/24] fixup --- heft-plugins/heft-rspack-plugin/heft-plugin.json | 2 +- heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/heft-plugins/heft-rspack-plugin/heft-plugin.json b/heft-plugins/heft-rspack-plugin/heft-plugin.json index 1a672ffd7fe..a8ce14984a6 100644 --- a/heft-plugins/heft-rspack-plugin/heft-plugin.json +++ b/heft-plugins/heft-rspack-plugin/heft-plugin.json @@ -12,7 +12,7 @@ { "longName": "--serve", "parameterKind": "flag", - "description": "Start a local web server for testing purposes using webpack-dev-server. This parameter is only available when running in watch mode." + "description": "Start a local web server for testing purposes using @rspack/dev-server. This parameter is only available when running in watch mode." } ] } diff --git a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts index 656749d9a7a..a74995b7a30 100644 --- a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts +++ b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts @@ -329,6 +329,7 @@ export default class RspackPlugin implements IHeftTaskPlugin { @@ -346,6 +347,7 @@ export default class RspackPlugin implements IHeftTaskPlugin Date: Mon, 6 Oct 2025 22:25:27 -0700 Subject: [PATCH 11/24] webpack-dev-server: add ipv6 loopback address support in terminal output --- .../rspack-plugin_2025-10-07-05-25.json | 10 ++++++++++ .../heft-webpack5-plugin/src/Webpack5Plugin.ts | 14 +++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 common/changes/@rushstack/heft-webpack5-plugin/rspack-plugin_2025-10-07-05-25.json diff --git a/common/changes/@rushstack/heft-webpack5-plugin/rspack-plugin_2025-10-07-05-25.json b/common/changes/@rushstack/heft-webpack5-plugin/rspack-plugin_2025-10-07-05-25.json new file mode 100644 index 00000000000..3e9d03da9d7 --- /dev/null +++ b/common/changes/@rushstack/heft-webpack5-plugin/rspack-plugin_2025-10-07-05-25.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@rushstack/heft-webpack5-plugin", + "comment": "dev-server: add ipv6 loopback address support in terminal output", + "type": "patch" + } + ], + "packageName": "@rushstack/heft-webpack5-plugin" +} \ No newline at end of file diff --git a/heft-plugins/heft-webpack5-plugin/src/Webpack5Plugin.ts b/heft-plugins/heft-webpack5-plugin/src/Webpack5Plugin.ts index d2d264d404c..c908d53be87 100644 --- a/heft-plugins/heft-webpack5-plugin/src/Webpack5Plugin.ts +++ b/heft-plugins/heft-webpack5-plugin/src/Webpack5Plugin.ts @@ -288,9 +288,17 @@ export default class Webpack5Plugin implements IHeftTaskPlugin { const addressInfo: AddressInfo | string | undefined = server.server?.address() as AddressInfo; if (addressInfo) { - const address: string = - typeof addressInfo === 'string' ? addressInfo : `${addressInfo.address}:${addressInfo.port}`; - taskSession.logger.terminal.writeLine(`Started Webpack Dev Server at https://${address}`); + let url: string; + if (typeof addressInfo === 'string') { + url = addressInfo; + } else { + const address: string = + addressInfo.family === 'IPv6' + ? `[${addressInfo.address}]:${addressInfo.port}` + : `${addressInfo.address}:${addressInfo.port}`; + url = `https://${address}/`; + } + taskSession.logger.terminal.writeLine(`Started Webpack Dev Server at ${url}`); } } }; From 087c9b1e97904eb44e907db4d58366ed29b1c346 Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Mon, 6 Oct 2025 22:39:57 -0700 Subject: [PATCH 12/24] update readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4109469a420..b5668edf6f2 100644 --- a/README.md +++ b/README.md @@ -187,6 +187,7 @@ These GitHub repositories provide supplementary resources for Rush Stack: | [/build-tests/heft-node-everything-test](./build-tests/heft-node-everything-test/) | Building this project tests every task and config file for Heft when targeting the Node.js runtime | | [/build-tests/heft-parameter-plugin](./build-tests/heft-parameter-plugin/) | This project contains a Heft plugin that adds a custom parameter to built-in actions | | [/build-tests/heft-parameter-plugin-test](./build-tests/heft-parameter-plugin-test/) | This project exercises a built-in Heft action with a custom parameter | +| [/build-tests/heft-rspack-everything-test](./build-tests/heft-rspack-everything-test/) | Building this project tests every task and config file for Heft when targeting the web browser runtime using Rspack | | [/build-tests/heft-sass-test](./build-tests/heft-sass-test/) | This project illustrates a minimal tutorial Heft project targeting the web browser runtime | | [/build-tests/heft-swc-test](./build-tests/heft-swc-test/) | Building this project tests building with SWC | | [/build-tests/heft-typescript-composite-test](./build-tests/heft-typescript-composite-test/) | Building this project tests behavior of Heft when the tsconfig.json file uses project references. | @@ -212,6 +213,7 @@ These GitHub repositories provide supplementary resources for Rush Stack: | [/build-tests/set-webpack-public-path-plugin-test](./build-tests/set-webpack-public-path-plugin-test/) | Building this project tests the set-webpack-public-path-plugin | | [/build-tests/webpack-local-version-test](./build-tests/webpack-local-version-test/) | Building this project tests the rig loading for the local version of webpack | | [/eslint/local-eslint-config](./eslint/local-eslint-config/) | An ESLint configuration consumed projects inside the rushstack repo. | +| [/heft-plugins/heft-rspack-plugin](./heft-plugins/heft-rspack-plugin/) | Heft plugin for Rspack | | [/libraries/rush-themed-ui](./libraries/rush-themed-ui/) | Rush Component Library: a set of themed components for rush projects | | [/libraries/rushell](./libraries/rushell/) | Execute shell commands using a consistent syntax on every platform | | [/repo-scripts/doc-plugin-rush-stack](./repo-scripts/doc-plugin-rush-stack/) | API Documenter plugin used with the rushstack.io website | From 7924a7f62e19be4b63a8e20718614928fb507b25 Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Mon, 6 Oct 2025 23:57:27 -0700 Subject: [PATCH 13/24] rename webpack --- heft-plugins/heft-rspack-plugin/src/shared.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/heft-plugins/heft-rspack-plugin/src/shared.ts b/heft-plugins/heft-rspack-plugin/src/shared.ts index 5fdbf582dd5..2d6db152843 100644 --- a/heft-plugins/heft-rspack-plugin/src/shared.ts +++ b/heft-plugins/heft-rspack-plugin/src/shared.ts @@ -15,16 +15,16 @@ import type { HeftConfiguration, IHeftTaskSession } from '@rushstack/heft'; export type RspackCoreImport = typeof import('@rspack/core'); /** - * The environment passed into the Webpack configuration function. Loosely based - * on the default Webpack environment options, specified here: - * https://webpack.js.org/api/cli/#environment-options + * The environment passed into the Rspack configuration function. Loosely based + * on the default Rspack environment options, specified here: + * https://rspack.rs/plugins/webpack/environment-plugin#options * * @beta */ export interface IRspackConfigurationFnEnvironment { /** * Whether or not the run is in production mode. Synonym of - * IWebpackConfigurationFnEnvironment.production. + * {@link IRspackConfigurationFnEnvironment.production}. */ prod: boolean; /** @@ -115,18 +115,18 @@ export interface IRspackPluginAccessorParameters { */ export interface IRspackPluginAccessor { /** - * Hooks that are called at various points in the Webpack plugin lifecycle. + * Hooks that are called at various points in the Rspack plugin lifecycle. */ readonly hooks: IRspackPluginAccessorHooks; /** - * Parameters that are provided by the Webpack plugin. + * Parameters that are provided by the Rspack plugin. */ readonly parameters: IRspackPluginAccessorParameters; } /** * The stage in the `onLoadConfiguration` hook at which the config will be loaded from the local - * webpack config file. + * rspack config file. * @beta */ export const STAGE_LOAD_LOCAL_CONFIG: 1000 = 1000; From dc64280cb06d982ebae6abe3d69ff41f9476e99b Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Mon, 6 Oct 2025 23:59:23 -0700 Subject: [PATCH 14/24] disable ipc mode for test project --- build-tests/heft-rspack-everything-test/package.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build-tests/heft-rspack-everything-test/package.json b/build-tests/heft-rspack-everything-test/package.json index 65e7727a630..eb29c558c63 100644 --- a/build-tests/heft-rspack-everything-test/package.json +++ b/build-tests/heft-rspack-everything-test/package.json @@ -8,9 +8,7 @@ "start": "heft build-watch", "serve": "heft build-watch --serve", "_phase:build": "heft run --only build -- --clean", - "_phase:build:ipc": "heft run-watch --only build -- --clean", - "_phase:test": "heft run --only test -- --clean", - "_phase:test:ipc": "heft run-watch --only test -- --clean" + "_phase:test": "heft run --only test -- --clean" }, "devDependencies": { "@rushstack/heft-dev-cert-plugin": "workspace:*", From dda0332d80dd3b77ac562e5a3859cb3dbd8cc99b Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Mon, 6 Oct 2025 23:59:33 -0700 Subject: [PATCH 15/24] compiler.hooks.infrastructureLog fixup --- heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts index a74995b7a30..a81fe92d3ca 100644 --- a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts +++ b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts @@ -337,9 +337,9 @@ export default class RspackPlugin implements IHeftTaskPlugin Date: Wed, 8 Oct 2025 21:25:15 -0700 Subject: [PATCH 16/24] fixup --- common/config/rush/nonbrowser-approved-packages.json | 8 ++++---- common/config/subspaces/default/pnpm-lock.yaml | 6 ------ heft-plugins/heft-rspack-plugin/package.json | 2 -- .../heft-rspack-plugin/src/RspackConfigurationLoader.ts | 3 ++- heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts | 5 ++--- heft-plugins/heft-webpack5-plugin/src/Webpack5Plugin.ts | 4 ++-- 6 files changed, 10 insertions(+), 18 deletions(-) diff --git a/common/config/rush/nonbrowser-approved-packages.json b/common/config/rush/nonbrowser-approved-packages.json index 4e486f0e688..f4a71081795 100644 --- a/common/config/rush/nonbrowser-approved-packages.json +++ b/common/config/rush/nonbrowser-approved-packages.json @@ -130,10 +130,6 @@ "name": "@rspack/dev-server", "allowedCategories": [ "libraries" ] }, - { - "name": "@rushstack/heft-rspack-plugin", - "allowedCategories": [ "tests" ] - }, { "name": "@rushstack/debug-certificate-manager", "allowedCategories": [ "libraries", "vscode-extensions" ] @@ -206,6 +202,10 @@ "name": "@rushstack/heft-node-rig", "allowedCategories": [ "libraries", "tests", "vscode-extensions" ] }, + { + "name": "@rushstack/heft-rspack-plugin", + "allowedCategories": [ "tests" ] + }, { "name": "@rushstack/heft-sass-load-themed-styles-plugin", "allowedCategories": [ "tests" ] diff --git a/common/config/subspaces/default/pnpm-lock.yaml b/common/config/subspaces/default/pnpm-lock.yaml index e84b2934035..a59b392a39f 100644 --- a/common/config/subspaces/default/pnpm-lock.yaml +++ b/common/config/subspaces/default/pnpm-lock.yaml @@ -3087,9 +3087,6 @@ importers: tapable: specifier: 1.1.3 version: 1.1.3 - watchpack: - specifier: 2.4.0 - version: 2.4.0 devDependencies: '@rspack/core': specifier: ~1.5.8 @@ -3100,9 +3097,6 @@ importers: '@rushstack/terminal': specifier: workspace:* version: link:../../libraries/terminal - '@types/watchpack': - specifier: 2.4.0 - version: 2.4.0 eslint: specifier: ~9.37.0 version: 9.37.0(supports-color@8.1.1) diff --git a/heft-plugins/heft-rspack-plugin/package.json b/heft-plugins/heft-rspack-plugin/package.json index b19d8aa1af2..14692a2f4f3 100644 --- a/heft-plugins/heft-rspack-plugin/package.json +++ b/heft-plugins/heft-rspack-plugin/package.json @@ -26,13 +26,11 @@ "@rushstack/node-core-library": "workspace:*", "@types/tapable": "1.0.6", "tapable": "1.1.3", - "watchpack": "2.4.0", "@rspack/dev-server": "^1.1.4" }, "devDependencies": { "@rushstack/heft": "workspace:*", "@rushstack/terminal": "workspace:*", - "@types/watchpack": "2.4.0", "eslint": "~9.37.0", "local-node-rig": "workspace:*", "@rspack/core": "~1.5.8", diff --git a/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts b/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts index 7a84712255b..517f165f611 100644 --- a/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts +++ b/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts @@ -12,6 +12,7 @@ import type { IRspackPluginOptions } from './RspackPlugin'; import { PLUGIN_NAME, STAGE_LOAD_LOCAL_CONFIG, + type RspackCoreImport, type IRspackConfiguration, type IRspackConfigurationFnEnvironment, type IRspackPluginAccessorHooks @@ -33,7 +34,7 @@ export interface ILoadRspackConfigurationOptions { taskSession: IHeftTaskSession; heftConfiguration: HeftConfiguration; serveMode: boolean; - loadRspackAsyncFn: () => Promise; + loadRspackAsyncFn: () => Promise; hooks: Pick; _tryLoadConfigFileAsync?: typeof tryLoadRspackConfigurationFileAsync; diff --git a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts index a81fe92d3ca..df28c06c75a 100644 --- a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts +++ b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts @@ -337,7 +337,6 @@ export default class RspackPlugin implements IHeftTaskPlugin Date: Wed, 15 Oct 2025 08:02:53 -0700 Subject: [PATCH 17/24] fixup --- .../{rspack.config.js => rspack.config.mjs} | 21 ++++++--- .../rspack.dev.config.js | 36 --------------- .../rspack.dev.config.mjs | 45 +++++++++++++++++++ .../config/subspaces/default/pnpm-lock.yaml | 13 +++--- common/reviews/api/heft-rspack-plugin.api.md | 13 +++--- heft-plugins/heft-rspack-plugin/package.json | 3 +- .../src/RspackConfigurationLoader.ts | 13 +++--- .../heft-rspack-plugin/src/RspackPlugin.ts | 25 ++++++++--- heft-plugins/heft-rspack-plugin/src/shared.ts | 13 +++--- 9 files changed, 108 insertions(+), 74 deletions(-) rename build-tests/heft-rspack-everything-test/{rspack.config.js => rspack.config.mjs} (52%) delete mode 100644 build-tests/heft-rspack-everything-test/rspack.dev.config.js create mode 100644 build-tests/heft-rspack-everything-test/rspack.dev.config.mjs diff --git a/build-tests/heft-rspack-everything-test/rspack.config.js b/build-tests/heft-rspack-everything-test/rspack.config.mjs similarity index 52% rename from build-tests/heft-rspack-everything-test/rspack.config.js rename to build-tests/heft-rspack-everything-test/rspack.config.mjs index 6048d76d45f..b9cd7b4d097 100644 --- a/build-tests/heft-rspack-everything-test/rspack.config.js +++ b/build-tests/heft-rspack-everything-test/rspack.config.mjs @@ -1,9 +1,16 @@ +// @ts-check +/** @typedef {import('@rushstack/heft-rspack-plugin').IRspackConfiguration} IRspackConfiguration */ 'use strict'; -const path = require('path'); -const { HtmlRspackPlugin, SwcJsMinimizerRspackPlugin } = require('@rspack/core'); +import { dirname, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { HtmlRspackPlugin, SwcJsMinimizerRspackPlugin } from '@rspack/core'; -module.exports = { +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +/** @type {IRspackConfiguration} */ +const config = { mode: 'production', module: { rules: [ @@ -23,11 +30,11 @@ module.exports = { extensions: ['.js', '.jsx', '.json'] }, entry: { - 'heft-test-A': path.join(__dirname, 'lib', 'indexA.js'), - 'heft-test-B': path.join(__dirname, 'lib', 'indexB.js') + 'heft-test-A': resolve(__dirname, 'lib', 'indexA.js'), + 'heft-test-B': resolve(__dirname, 'lib', 'indexB.js') }, output: { - path: path.join(__dirname, 'dist'), + path: resolve(__dirname, 'dist'), filename: '[name]_[contenthash].js', chunkFilename: '[id].[name]_[contenthash].js', assetModuleFilename: '[name]_[contenthash][ext][query]' @@ -39,3 +46,5 @@ module.exports = { }, plugins: [new HtmlRspackPlugin()] }; + +export default config; diff --git a/build-tests/heft-rspack-everything-test/rspack.dev.config.js b/build-tests/heft-rspack-everything-test/rspack.dev.config.js deleted file mode 100644 index 5a716d9bbb8..00000000000 --- a/build-tests/heft-rspack-everything-test/rspack.dev.config.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; - -const path = require('path'); -const { HtmlRspackPlugin } = require('@rspack/core'); - -module.exports = { - mode: 'none', - module: { - rules: [ - { - test: /\.png$/i, - type: 'asset/resource' - } - ] - }, - target: ['web', 'es2020'], - resolve: { - extensions: ['.js', '.jsx', '.json'] - }, - entry: { - 'heft-test-A': path.join(__dirname, 'lib', 'indexA.js'), - 'heft-test-B': path.join(__dirname, 'lib', 'indexB.js') - }, - output: { - path: path.join(__dirname, 'dist'), - filename: '[name]_[contenthash].js', - chunkFilename: '[id].[name]_[contenthash].js', - assetModuleFilename: '[name]_[contenthash][ext][query]' - }, - devtool: 'source-map', - optimization: { - minimize: false, - minimizer: [] - }, - plugins: [new HtmlRspackPlugin()] -}; diff --git a/build-tests/heft-rspack-everything-test/rspack.dev.config.mjs b/build-tests/heft-rspack-everything-test/rspack.dev.config.mjs new file mode 100644 index 00000000000..cfe4bed6dae --- /dev/null +++ b/build-tests/heft-rspack-everything-test/rspack.dev.config.mjs @@ -0,0 +1,45 @@ +// @ts-check +/** @typedef {import('@rushstack/heft-rspack-plugin').IRspackConfiguration} IRspackConfiguration */ +'use strict'; + +import { dirname, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { HtmlRspackPlugin } from '@rspack/core'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +/** @type {IRspackConfiguration} */ +const config = { + mode: 'none', + module: { + rules: [ + { + test: /\.png$/i, + type: 'asset/resource' + } + ] + }, + target: ['web', 'es2020'], + resolve: { + extensions: ['.js', '.jsx', '.json'] + }, + entry: { + 'heft-test-A': resolve(__dirname, 'lib', 'indexA.js'), + 'heft-test-B': resolve(__dirname, 'lib', 'indexB.js') + }, + output: { + path: resolve(__dirname, 'dist'), + filename: '[name]_[contenthash].js', + chunkFilename: '[id].[name]_[contenthash].js', + assetModuleFilename: '[name]_[contenthash][ext][query]' + }, + devtool: 'source-map', + optimization: { + minimize: false, + minimizer: [] + }, + plugins: [new HtmlRspackPlugin()] +}; + +export default config; diff --git a/common/config/subspaces/default/pnpm-lock.yaml b/common/config/subspaces/default/pnpm-lock.yaml index a59b392a39f..33377185bf2 100644 --- a/common/config/subspaces/default/pnpm-lock.yaml +++ b/common/config/subspaces/default/pnpm-lock.yaml @@ -3081,12 +3081,9 @@ importers: '@rushstack/node-core-library': specifier: workspace:* version: link:../../libraries/node-core-library - '@types/tapable': - specifier: 1.0.6 - version: 1.0.6 tapable: - specifier: 1.1.3 - version: 1.1.3 + specifier: 2.3.0 + version: 2.3.0 devDependencies: '@rspack/core': specifier: ~1.5.8 @@ -19148,7 +19145,7 @@ packages: engines: {node: '>=10.13.0'} dependencies: graceful-fs: 4.2.11 - tapable: 2.2.1 + tapable: 2.3.0 /enquirer@2.4.1: resolution: {integrity: sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==} @@ -29473,6 +29470,10 @@ packages: resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} engines: {node: '>=6'} + /tapable@2.3.0: + resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==} + engines: {node: '>=6'} + /tar-fs@2.1.1: resolution: {integrity: sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==} requiresBuild: true diff --git a/common/reviews/api/heft-rspack-plugin.api.md b/common/reviews/api/heft-rspack-plugin.api.md index 1127c379193..a51e6cf9590 100644 --- a/common/reviews/api/heft-rspack-plugin.api.md +++ b/common/reviews/api/heft-rspack-plugin.api.md @@ -41,11 +41,14 @@ export interface IRspackPluginAccessor { // @beta (undocumented) export interface IRspackPluginAccessorHooks { - readonly onAfterConfigure: AsyncParallelHook; - readonly onConfigure: AsyncSeriesHook; - readonly onEmitStats: AsyncParallelHook; - readonly onGetWatchOptions: AsyncSeriesWaterfallHook[0], Readonly, never>; - readonly onLoadConfiguration: AsyncSeriesBailHook; + readonly onAfterConfigure: AsyncParallelHook<[IRspackConfiguration], never>; + readonly onConfigure: AsyncSeriesHook<[IRspackConfiguration], never>; + readonly onEmitStats: AsyncParallelHook<[TRspack.Stats | TRspack.MultiStats], never>; + readonly onGetWatchOptions: AsyncSeriesWaterfallHook<[ + Parameters[0], + Readonly + ], never>; + readonly onLoadConfiguration: AsyncSeriesBailHook<[], IRspackConfiguration | undefined | false>; } // @beta (undocumented) diff --git a/heft-plugins/heft-rspack-plugin/package.json b/heft-plugins/heft-rspack-plugin/package.json index 14692a2f4f3..5064fd5b892 100644 --- a/heft-plugins/heft-rspack-plugin/package.json +++ b/heft-plugins/heft-rspack-plugin/package.json @@ -24,8 +24,7 @@ "dependencies": { "@rushstack/debug-certificate-manager": "workspace:*", "@rushstack/node-core-library": "workspace:*", - "@types/tapable": "1.0.6", - "tapable": "1.1.3", + "tapable": "2.3.0", "@rspack/dev-server": "^1.1.4" }, "devDependencies": { diff --git a/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts b/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts index 517f165f611..3d7013df183 100644 --- a/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts +++ b/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts @@ -5,17 +5,16 @@ import * as path from 'node:path'; import type * as TRspack from '@rspack/core'; +import type { HeftConfiguration, IHeftTaskSession } from '@rushstack/heft'; import { FileSystem } from '@rushstack/node-core-library'; -import type { IHeftTaskSession, HeftConfiguration } from '@rushstack/heft'; import type { IRspackPluginOptions } from './RspackPlugin'; import { - PLUGIN_NAME, - STAGE_LOAD_LOCAL_CONFIG, - type RspackCoreImport, type IRspackConfiguration, type IRspackConfigurationFnEnvironment, - type IRspackPluginAccessorHooks + type IRspackPluginAccessorHooks, + PLUGIN_NAME, + STAGE_LOAD_LOCAL_CONFIG } from './shared'; type IRspackConfigJsExport = @@ -34,13 +33,13 @@ export interface ILoadRspackConfigurationOptions { taskSession: IHeftTaskSession; heftConfiguration: HeftConfiguration; serveMode: boolean; - loadRspackAsyncFn: () => Promise; + loadRspackAsyncFn: () => Promise; hooks: Pick; _tryLoadConfigFileAsync?: typeof tryLoadRspackConfigurationFileAsync; } -const DEFAULT_RSPACK_CONFIG_PATH: './rspack.config.js' = './rspack.config.js'; +const DEFAULT_RSPACK_CONFIG_PATH: './rspack.config.mjs' = './rspack.config.mjs'; const DEFAULT_RSPACK_DEV_CONFIG_PATH: './rspack.dev.config.js' = './rspack.dev.config.js'; /** diff --git a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts index df28c06c75a..971ac512b60 100644 --- a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts +++ b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts @@ -105,7 +105,7 @@ export default class RspackPlugin implements IHeftTaskPlugin { + private async _loadRspackAsync( + taskSession: IHeftTaskSession, + heftConfiguration: HeftConfiguration + ): Promise { if (!this._rspack) { - // Allow this to fail if Rspack is not installed - this._rspack = await import(RSPACK_PACKAGE_NAME); + try { + const rspackPackagePath: string = await heftConfiguration.rigPackageResolver.resolvePackageAsync( + RSPACK_PACKAGE_NAME, + taskSession.logger.terminal + ); + this._rspack = await import(rspackPackagePath); + } catch (e) { + // Fallback to bundled version if not found in rig. + this._rspack = await import(RSPACK_PACKAGE_NAME); + taskSession.logger.terminal.writeDebugLine(`Using Rspack from built-in "${RSPACK_PACKAGE_NAME}"`); + } } return this._rspack!; } private async _getRspackCompilerAsync( taskSession: IHeftTaskSession, + heftConfiguration: HeftConfiguration, rspackConfiguration: IRspackConfiguration ): Promise { if (!this._rspackCompiler) { - const rspack: RspackCoreImport = await this._loadRspackAsync(); + const rspack: RspackCoreImport = await this._loadRspackAsync(taskSession, heftConfiguration); taskSession.logger.terminal.writeLine(`Using Rspack version ${rspack.version}`); this._rspackCompiler = Array.isArray(rspackConfiguration) ? rspack.default(rspackConfiguration) /* (rspack.Compilation[]) => MultiCompiler */ @@ -160,6 +173,7 @@ export default class RspackPlugin implements IHeftTaskPlugin; + readonly onLoadConfiguration: AsyncSeriesBailHook<[], IRspackConfiguration | undefined | false>; /** * A hook that allows for modification of the loaded configuration used by the Rspack * plugin. If no configuration was loaded, this hook will not be called. */ - readonly onConfigure: AsyncSeriesHook; + readonly onConfigure: AsyncSeriesHook<[IRspackConfiguration], never>; /** * A hook that provides the finalized configuration that will be used by Rspack. * If no configuration was loaded, this hook will not be called. */ - readonly onAfterConfigure: AsyncParallelHook; + readonly onAfterConfigure: AsyncParallelHook<[IRspackConfiguration], never>; /** * A hook that provides the stats output from Rspack. If no configuration is loaded, * this hook will not be called. */ - readonly onEmitStats: AsyncParallelHook; + readonly onEmitStats: AsyncParallelHook<[TRspack.Stats | TRspack.MultiStats], never>; /** * A hook that allows for customization of the file watcher options. If not running in watch mode, this hook will not be called. */ readonly onGetWatchOptions: AsyncSeriesWaterfallHook< - Parameters[0], - Readonly, + [Parameters[0], Readonly], never >; } From d0bdf5bebe9fcc564f57a5f5248d6be196960b83 Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Wed, 15 Oct 2025 11:00:21 -0700 Subject: [PATCH 18/24] nodenext --- .../heft-rspack-plugin/src/RspackConfigurationLoader.ts | 4 +++- heft-plugins/heft-rspack-plugin/tsconfig.json | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts b/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts index 3d7013df183..3864f08dc6f 100644 --- a/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts +++ b/heft-plugins/heft-rspack-plugin/src/RspackConfigurationLoader.ts @@ -2,6 +2,7 @@ // See LICENSE in the project root for license information. import * as path from 'node:path'; +import { pathToFileURL } from 'node:url'; import type * as TRspack from '@rspack/core'; @@ -173,7 +174,8 @@ export async function _tryLoadRspackConfigurationFileInnerAsync( const configExists: boolean = await FileSystem.existsAsync(configurationPath); if (configExists) { try { - return await import(configurationPath); + const configurationUri: string = pathToFileURL(configurationPath).href; + return await import(configurationUri); } catch (e) { const error: NodeJS.ErrnoException = e as NodeJS.ErrnoException; if (error.code === 'ERR_MODULE_NOT_FOUND') { diff --git a/heft-plugins/heft-rspack-plugin/tsconfig.json b/heft-plugins/heft-rspack-plugin/tsconfig.json index 76eab893141..e64ab1d2405 100644 --- a/heft-plugins/heft-rspack-plugin/tsconfig.json +++ b/heft-plugins/heft-rspack-plugin/tsconfig.json @@ -3,6 +3,8 @@ "compilerOptions": { "lib": [ "DOM" - ] + ], + "module": "nodenext", + "moduleResolution": "nodenext" } } \ No newline at end of file From 4a12e8ed7b2a31f9f6cde26f3ed03b6403a45a4e Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Wed, 15 Oct 2025 13:08:25 -0700 Subject: [PATCH 19/24] rush update --- common/config/subspaces/default/repo-state.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/config/subspaces/default/repo-state.json b/common/config/subspaces/default/repo-state.json index 0e7e44523cd..47889341c2b 100644 --- a/common/config/subspaces/default/repo-state.json +++ b/common/config/subspaces/default/repo-state.json @@ -1,5 +1,5 @@ // DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush. { - "pnpmShrinkwrapHash": "b483220c289054803691f7c96d6b5278c7a05fce", + "pnpmShrinkwrapHash": "05f30a4fc318c568d5d5a593394d2f615f2f54a1", "preferredVersionsHash": "a9b67c38568259823f9cfb8270b31bf6d8470b27" } From 616a8e4f53112587326de3b4886342285010a8ba Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Wed, 15 Oct 2025 13:40:58 -0700 Subject: [PATCH 20/24] pr feedback: fixup error message --- heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts | 2 +- heft-plugins/heft-webpack5-plugin/src/Webpack5Plugin.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts index 971ac512b60..440c1f603c7 100644 --- a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts +++ b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts @@ -213,7 +213,7 @@ export default class RspackPlugin implements IHeftTaskPlugin Date: Wed, 15 Oct 2025 15:31:17 -0700 Subject: [PATCH 21/24] pr feedback --- .../heft-storybook-react-tutorial/webpack.config.js | 2 +- .../heft-webpack-basic-tutorial/webpack.config.js | 2 +- build-tests/heft-rspack-everything-test/package.json | 4 +--- .../heft-rspack-everything-test/rspack.config.mjs | 7 ++++--- .../rspack.dev.config.mjs | 2 +- .../heft-webpack4-everything-test/webpack.config.js | 2 +- .../heft-webpack5-everything-test/webpack.config.js | 2 +- .../webpack.dev.config.js | 2 +- .../localization-plugin-test-03/webpack.config.js | 2 +- common/config/subspaces/default/pnpm-lock.yaml | 12 +++--------- common/reviews/api/heft-rspack-plugin.api.md | 6 +++--- heft-plugins/heft-rspack-plugin/package.json | 8 ++++---- heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts | 1 + heft-plugins/heft-rspack-plugin/src/index.ts | 9 ++++++++- heft-plugins/heft-rspack-plugin/src/shared.ts | 3 +++ .../heft-webpack5-plugin/src/Webpack5Plugin.ts | 1 + 16 files changed, 35 insertions(+), 30 deletions(-) diff --git a/build-tests-samples/heft-storybook-react-tutorial/webpack.config.js b/build-tests-samples/heft-storybook-react-tutorial/webpack.config.js index 74788cd1048..e509592fe18 100644 --- a/build-tests-samples/heft-storybook-react-tutorial/webpack.config.js +++ b/build-tests-samples/heft-storybook-react-tutorial/webpack.config.js @@ -13,7 +13,7 @@ function createWebpackConfig({ production }) { // Documentation: https://webpack.js.org/configuration/mode/ mode: production ? 'production' : 'development', resolve: { - extensions: ['.js', '.jsx', '.json'] + extensions: ['.js', '.json'] }, module: { rules: [ diff --git a/build-tests-samples/heft-webpack-basic-tutorial/webpack.config.js b/build-tests-samples/heft-webpack-basic-tutorial/webpack.config.js index c6a4c30ea7d..683afc0cc96 100644 --- a/build-tests-samples/heft-webpack-basic-tutorial/webpack.config.js +++ b/build-tests-samples/heft-webpack-basic-tutorial/webpack.config.js @@ -12,7 +12,7 @@ function createWebpackConfig({ production }) { // Documentation: https://webpack.js.org/configuration/mode/ mode: production ? 'production' : 'development', resolve: { - extensions: ['.js', '.jsx', '.json'] + extensions: ['.js', '.json'] }, module: { rules: [ diff --git a/build-tests/heft-rspack-everything-test/package.json b/build-tests/heft-rspack-everything-test/package.json index eb29c558c63..6055d7d4ac0 100644 --- a/build-tests/heft-rspack-everything-test/package.json +++ b/build-tests/heft-rspack-everything-test/package.json @@ -23,9 +23,7 @@ "@types/node": "20.17.19", "eslint": "~9.37.0", "local-eslint-config": "workspace:*", - "source-map-loader": "~3.0.1", "typescript": "~5.8.2", - "@rspack/core": "~1.5.8", - "webpack": "~5.98.0" + "@rspack/core": "~1.5.8" } } \ No newline at end of file diff --git a/build-tests/heft-rspack-everything-test/rspack.config.mjs b/build-tests/heft-rspack-everything-test/rspack.config.mjs index b9cd7b4d097..fa68d03598f 100644 --- a/build-tests/heft-rspack-everything-test/rspack.config.mjs +++ b/build-tests/heft-rspack-everything-test/rspack.config.mjs @@ -20,14 +20,15 @@ const config = { }, { test: /\.js$/, - enforce: 'pre', - use: ['source-map-loader'] + enforce: 'pre' + // TODO: enable after rspack drops a new version with this commit https://github.com/web-infra-dev/rspack/commit/d31f2fa07179d72eee99b21db517946d08073767 + // extractSourceMap: true } ] }, target: ['web', 'es2020'], resolve: { - extensions: ['.js', '.jsx', '.json'] + extensions: ['.js', '.json'] }, entry: { 'heft-test-A': resolve(__dirname, 'lib', 'indexA.js'), diff --git a/build-tests/heft-rspack-everything-test/rspack.dev.config.mjs b/build-tests/heft-rspack-everything-test/rspack.dev.config.mjs index cfe4bed6dae..3e0315a615d 100644 --- a/build-tests/heft-rspack-everything-test/rspack.dev.config.mjs +++ b/build-tests/heft-rspack-everything-test/rspack.dev.config.mjs @@ -22,7 +22,7 @@ const config = { }, target: ['web', 'es2020'], resolve: { - extensions: ['.js', '.jsx', '.json'] + extensions: ['.js', '.json'] }, entry: { 'heft-test-A': resolve(__dirname, 'lib', 'indexA.js'), diff --git a/build-tests/heft-webpack4-everything-test/webpack.config.js b/build-tests/heft-webpack4-everything-test/webpack.config.js index a6aa6151bdb..c4be9e959c4 100644 --- a/build-tests/heft-webpack4-everything-test/webpack.config.js +++ b/build-tests/heft-webpack4-everything-test/webpack.config.js @@ -24,7 +24,7 @@ module.exports = { ] }, resolve: { - extensions: ['.js', '.jsx', '.json'] + extensions: ['.js', '.json'] }, entry: { 'heft-test-A': path.join(__dirname, 'lib', 'indexA.js'), diff --git a/build-tests/heft-webpack5-everything-test/webpack.config.js b/build-tests/heft-webpack5-everything-test/webpack.config.js index 68ab9d96538..25edbf94925 100644 --- a/build-tests/heft-webpack5-everything-test/webpack.config.js +++ b/build-tests/heft-webpack5-everything-test/webpack.config.js @@ -22,7 +22,7 @@ module.exports = { }, target: ['web', 'es2020'], resolve: { - extensions: ['.js', '.jsx', '.json'] + extensions: ['.js', '.json'] }, entry: { 'heft-test-A': path.join(__dirname, 'lib', 'indexA.js'), diff --git a/build-tests/heft-webpack5-everything-test/webpack.dev.config.js b/build-tests/heft-webpack5-everything-test/webpack.dev.config.js index 25459e25909..504bdc6e13c 100644 --- a/build-tests/heft-webpack5-everything-test/webpack.dev.config.js +++ b/build-tests/heft-webpack5-everything-test/webpack.dev.config.js @@ -15,7 +15,7 @@ module.exports = { }, target: ['web', 'es2020'], resolve: { - extensions: ['.js', '.jsx', '.json'] + extensions: ['.js', '.json'] }, entry: { 'heft-test-A': path.join(__dirname, 'lib', 'indexA.js'), diff --git a/build-tests/localization-plugin-test-03/webpack.config.js b/build-tests/localization-plugin-test-03/webpack.config.js index 80b0f933a4f..56d3cf532e8 100644 --- a/build-tests/localization-plugin-test-03/webpack.config.js +++ b/build-tests/localization-plugin-test-03/webpack.config.js @@ -51,7 +51,7 @@ function generateConfiguration(mode, outputFolderName, webpack) { ] }, resolve: { - extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'] + extensions: ['.js', '.json', '.ts', '.tsx'] }, entry: { 'localization-test-A': `${__dirname}/src/indexA.ts`, diff --git a/common/config/subspaces/default/pnpm-lock.yaml b/common/config/subspaces/default/pnpm-lock.yaml index 33377185bf2..47a6c1459e3 100644 --- a/common/config/subspaces/default/pnpm-lock.yaml +++ b/common/config/subspaces/default/pnpm-lock.yaml @@ -1858,15 +1858,9 @@ importers: local-eslint-config: specifier: workspace:* version: link:../../eslint/local-eslint-config - source-map-loader: - specifier: ~3.0.1 - version: 3.0.2(webpack@5.98.0) typescript: specifier: ~5.8.2 version: 5.8.2 - webpack: - specifier: ~5.98.0 - version: 5.98.0 ../../../build-tests/heft-sass-test: dependencies: @@ -3084,6 +3078,9 @@ importers: tapable: specifier: 2.3.0 version: 2.3.0 + webpack: + specifier: ~5.98.0 + version: 5.98.0 devDependencies: '@rspack/core': specifier: ~1.5.8 @@ -3100,9 +3097,6 @@ importers: local-node-rig: specifier: workspace:* version: link:../../rigs/local-node-rig - webpack: - specifier: ~5.98.0 - version: 5.98.0 ../../../heft-plugins/heft-sass-load-themed-styles-plugin: dependencies: diff --git a/common/reviews/api/heft-rspack-plugin.api.md b/common/reviews/api/heft-rspack-plugin.api.md index a51e6cf9590..2d2020909d9 100644 --- a/common/reviews/api/heft-rspack-plugin.api.md +++ b/common/reviews/api/heft-rspack-plugin.api.md @@ -22,7 +22,6 @@ export interface IRspackConfigurationFnEnvironment { heftConfiguration: HeftConfiguration; prod: boolean; production: boolean; - // Warning: (ae-forgotten-export) The symbol "RspackCoreImport" needs to be exported by the entry point index.d.ts rspack: RspackCoreImport; taskSession: IHeftTaskSession; } @@ -59,9 +58,10 @@ export interface IRspackPluginAccessorParameters { // @beta (undocumented) export const PluginName: 'rspack-plugin'; +// @beta (undocumented) +export type RspackCoreImport = rspackCore; + // @beta export const STAGE_LOAD_LOCAL_CONFIG: 1000; -// (No @packageDocumentation comment for this package) - ``` diff --git a/heft-plugins/heft-rspack-plugin/package.json b/heft-plugins/heft-rspack-plugin/package.json index 5064fd5b892..5591cd33178 100644 --- a/heft-plugins/heft-rspack-plugin/package.json +++ b/heft-plugins/heft-rspack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@rushstack/heft-rspack-plugin", - "version": "0.11.43", + "version": "0.0.0", "description": "Heft plugin for Rspack", "repository": { "type": "git", @@ -25,14 +25,14 @@ "@rushstack/debug-certificate-manager": "workspace:*", "@rushstack/node-core-library": "workspace:*", "tapable": "2.3.0", - "@rspack/dev-server": "^1.1.4" + "@rspack/dev-server": "^1.1.4", + "webpack": "~5.98.0" }, "devDependencies": { "@rushstack/heft": "workspace:*", "@rushstack/terminal": "workspace:*", "eslint": "~9.37.0", "local-node-rig": "workspace:*", - "@rspack/core": "~1.5.8", - "webpack": "~5.98.0" + "@rspack/core": "~1.5.8" } } \ No newline at end of file diff --git a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts index 440c1f603c7..4349b82a2be 100644 --- a/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts +++ b/heft-plugins/heft-rspack-plugin/src/RspackPlugin.ts @@ -127,6 +127,7 @@ export default class RspackPlugin implements IHeftTaskPlugin Date: Wed, 15 Oct 2025 15:34:09 -0700 Subject: [PATCH 22/24] rush change --- .../rspack-plugin_2025-10-15-22-34.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@rushstack/heft-webpack5-plugin/rspack-plugin_2025-10-15-22-34.json diff --git a/common/changes/@rushstack/heft-webpack5-plugin/rspack-plugin_2025-10-15-22-34.json b/common/changes/@rushstack/heft-webpack5-plugin/rspack-plugin_2025-10-15-22-34.json new file mode 100644 index 00000000000..e78af2cd5ac --- /dev/null +++ b/common/changes/@rushstack/heft-webpack5-plugin/rspack-plugin_2025-10-15-22-34.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@rushstack/heft-webpack5-plugin", + "comment": "add debug log when Webpack is imported from the rig package", + "type": "patch" + } + ], + "packageName": "@rushstack/heft-webpack5-plugin" +} \ No newline at end of file From f46f2b0a87957c0f279eb2888990c3b8755c3342 Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Fri, 17 Oct 2025 11:10:49 -0700 Subject: [PATCH 23/24] fix sourcemaps --- .../heft-rspack-everything-test/package.json | 2 +- .../config/subspaces/default/pnpm-lock.yaml | 136 +++++++++--------- .../config/subspaces/default/repo-state.json | 2 +- heft-plugins/heft-rspack-plugin/package.json | 4 +- 4 files changed, 72 insertions(+), 72 deletions(-) diff --git a/build-tests/heft-rspack-everything-test/package.json b/build-tests/heft-rspack-everything-test/package.json index 6055d7d4ac0..0b83d231efa 100644 --- a/build-tests/heft-rspack-everything-test/package.json +++ b/build-tests/heft-rspack-everything-test/package.json @@ -24,6 +24,6 @@ "eslint": "~9.37.0", "local-eslint-config": "workspace:*", "typescript": "~5.8.2", - "@rspack/core": "~1.5.8" + "@rspack/core": "~1.6.0-beta.0" } } \ No newline at end of file diff --git a/common/config/subspaces/default/pnpm-lock.yaml b/common/config/subspaces/default/pnpm-lock.yaml index 47a6c1459e3..3008c3b9ce2 100644 --- a/common/config/subspaces/default/pnpm-lock.yaml +++ b/common/config/subspaces/default/pnpm-lock.yaml @@ -1820,8 +1820,8 @@ importers: ../../../build-tests/heft-rspack-everything-test: devDependencies: '@rspack/core': - specifier: ~1.5.8 - version: 1.5.8 + specifier: ~1.6.0-beta.0 + version: 1.6.0-beta.0 '@rushstack/heft': specifier: workspace:* version: link:../../apps/heft @@ -3068,7 +3068,7 @@ importers: dependencies: '@rspack/dev-server': specifier: ^1.1.4 - version: 1.1.4(@rspack/core@1.5.8)(webpack@5.98.0) + version: 1.1.4(@rspack/core@1.6.0-beta.0)(webpack@5.98.0) '@rushstack/debug-certificate-manager': specifier: workspace:* version: link:../../libraries/debug-certificate-manager @@ -3083,8 +3083,8 @@ importers: version: 5.98.0 devDependencies: '@rspack/core': - specifier: ~1.5.8 - version: 1.5.8 + specifier: ~1.6.0-beta.0 + version: 1.6.0-beta.0 '@rushstack/heft': specifier: workspace:* version: link:../../apps/heft @@ -10517,36 +10517,36 @@ packages: - supports-color dev: false - /@module-federation/error-codes@0.18.0: - resolution: {integrity: sha512-Woonm8ehyVIUPXChmbu80Zj6uJkC0dD9SJUZ/wOPtO8iiz/m+dkrOugAuKgoiR6qH4F+yorWila954tBz4uKsQ==} + /@module-federation/error-codes@0.20.0: + resolution: {integrity: sha512-pwKqIFXHG72AaXjtptZb+l5VOO3O7JQMVZ4txFhBH4H/BMu7o1LRBONllTisVmojLHOC/RQpBrxXSGrC64LC4w==} - /@module-federation/runtime-core@0.18.0: - resolution: {integrity: sha512-ZyYhrDyVAhUzriOsVfgL6vwd+5ebYm595Y13KeMf6TKDRoUHBMTLGQ8WM4TDj8JNsy7LigncK8C03fn97of0QQ==} + /@module-federation/runtime-core@0.20.0: + resolution: {integrity: sha512-M/0F/Ed6o1eCC5gKW3V3QtbxeNZ1w0Y7r6NKNacnwKKC12Nn7Ty9Rg1Kjw2B13EUqP8Qs2Y2IwmBEApy7cFLMw==} dependencies: - '@module-federation/error-codes': 0.18.0 - '@module-federation/sdk': 0.18.0 + '@module-federation/error-codes': 0.20.0 + '@module-federation/sdk': 0.20.0 - /@module-federation/runtime-tools@0.18.0: - resolution: {integrity: sha512-fSga9o4t1UfXNV/Kh6qFvRyZpPp3EHSPRISNeyT8ZoTpzDNiYzhtw0BPUSSD8m6C6XQh2s/11rI4g80UY+d+hA==} + /@module-federation/runtime-tools@0.20.0: + resolution: {integrity: sha512-5NimrYQyYr8hBl48YVU+w6bzl9uWDKNq3IEqYDgYljTYlupbVqsH2MJTf2A+c95nuCycjHS0vp5B3rnJ3Kdotg==} dependencies: - '@module-federation/runtime': 0.18.0 - '@module-federation/webpack-bundler-runtime': 0.18.0 + '@module-federation/runtime': 0.20.0 + '@module-federation/webpack-bundler-runtime': 0.20.0 - /@module-federation/runtime@0.18.0: - resolution: {integrity: sha512-+C4YtoSztM7nHwNyZl6dQKGUVJdsPrUdaf3HIKReg/GQbrt9uvOlUWo2NXMZ8vDAnf/QRrpSYAwXHmWDn9Obaw==} + /@module-federation/runtime@0.20.0: + resolution: {integrity: sha512-9vHE27aLCWbvzUfYWCTCsNbx4IQ5MtK3f340s4swQofTKj0Qv5dJ6gRIwmHk3DqvH5/1FZoQi3FYMCmrThiGrg==} dependencies: - '@module-federation/error-codes': 0.18.0 - '@module-federation/runtime-core': 0.18.0 - '@module-federation/sdk': 0.18.0 + '@module-federation/error-codes': 0.20.0 + '@module-federation/runtime-core': 0.20.0 + '@module-federation/sdk': 0.20.0 - /@module-federation/sdk@0.18.0: - resolution: {integrity: sha512-Lo/Feq73tO2unjmpRfyyoUkTVoejhItXOk/h5C+4cistnHbTV8XHrW/13fD5e1Iu60heVdAhhelJd6F898Ve9A==} + /@module-federation/sdk@0.20.0: + resolution: {integrity: sha512-bBFGA07PpfioJLY0DITVe+szGwLtFad+8R4rb5bPFKCZPZsKqLKwMB9tSsdHeieFPSc+1v20s6wq+R1DiWe56Q==} - /@module-federation/webpack-bundler-runtime@0.18.0: - resolution: {integrity: sha512-TEvErbF+YQ+6IFimhUYKK3a5wapD90d90sLsNpcu2kB3QGT7t4nIluE25duXuZDVUKLz86tEPrza/oaaCWTpvQ==} + /@module-federation/webpack-bundler-runtime@0.20.0: + resolution: {integrity: sha512-TB0v5FRjfpL5fR8O5L4L3FTKJsb4EsflK8aNkdrJ46Tm/MR+PvL4SEx/AXpnsY+g/zkGRkiz10vwF0/RgMh6fQ==} dependencies: - '@module-federation/runtime': 0.18.0 - '@module-federation/sdk': 0.18.0 + '@module-federation/runtime': 0.20.0 + '@module-federation/sdk': 0.20.0 /@mrmlnc/readdir-enhanced@2.2.1: resolution: {integrity: sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==} @@ -10556,8 +10556,8 @@ packages: glob-to-regexp: 0.3.0 dev: true - /@napi-rs/wasm-runtime@1.0.6: - resolution: {integrity: sha512-DXj75ewm11LIWUk198QSKUTxjyRjsBwk09MuMk5DGK+GDUtyPhhEHOGP/Xwwj3DjQXXkivoBirmOnKrLfc0+9g==} + /@napi-rs/wasm-runtime@1.0.7: + resolution: {integrity: sha512-SeDnOO0Tk7Okiq6DbXmmBODgOAb9dp9gjlphokTUxmt8U3liIP1ZsozBahH69j/RJv+Rfs6IwUKHTgQYJ/HBAw==} requiresBuild: true dependencies: '@emnapi/core': 1.5.0 @@ -11288,93 +11288,93 @@ packages: engines: {node: '>=14.0.0'} dev: true - /@rspack/binding-darwin-arm64@1.5.8: - resolution: {integrity: sha512-spJfpOSN3f7V90ic45/ET2NKB2ujAViCNmqb0iGurMNQtFRq+7Kd+jvVKKGXKBHBbsQrFhidSWbbqy2PBPGK8g==} + /@rspack/binding-darwin-arm64@1.6.0-beta.0: + resolution: {integrity: sha512-iRza6XmLT0obDwlaFvZ/LUJ3FqbcZnwA48C1bwCUlDnM+9uVFInCrcHkOjKuXnNcWBBJvNmLDWA5XYWzjtbXsw==} cpu: [arm64] os: [darwin] requiresBuild: true optional: true - /@rspack/binding-darwin-x64@1.5.8: - resolution: {integrity: sha512-YFOzeL1IBknBcri8vjUp43dfUBylCeQnD+9O9p0wZmLAw7DtpN5JEOe2AkGo8kdTqJjYKI+cczJPKIw6lu1LWw==} + /@rspack/binding-darwin-x64@1.6.0-beta.0: + resolution: {integrity: sha512-4rHw6IHpWO04C22lEQK34vk6H+CtBkVQK9pEoA4gr+zMX8H+Bfl8liVQgeaAgwRqD7ipDo3jXGLaakVGktDexw==} cpu: [x64] os: [darwin] requiresBuild: true optional: true - /@rspack/binding-linux-arm64-gnu@1.5.8: - resolution: {integrity: sha512-UAWCsOnpkvy8eAVRo0uipbHXDhnoDq5zmqWTMhpga0/a3yzCp2e+fnjZb/qnFNYb5MeL0O1mwMOYgn1M3oHILQ==} + /@rspack/binding-linux-arm64-gnu@1.6.0-beta.0: + resolution: {integrity: sha512-ww45NhAOreOYRFpjf1TYRvNQYLOMr/LodFZA1yI5MLRCSYMgvWuv6B1WIY7o3pLaGWeY/H+zf89JTpR2rNn25g==} cpu: [arm64] os: [linux] requiresBuild: true optional: true - /@rspack/binding-linux-arm64-musl@1.5.8: - resolution: {integrity: sha512-GnSvGT4GjokPSD45cTtE+g7LgghuxSP1MRmvd+Vp/I8pnxTVSTsebRod4TAqyiv+l11nuS8yqNveK9qiOkBLWw==} + /@rspack/binding-linux-arm64-musl@1.6.0-beta.0: + resolution: {integrity: sha512-nxkqLF8vz62NR65wxxMpdRDXce6q36R3BHvibyXlElSbSPSPL0n7gsOW2yMeCB5q812DRkzm2c9RNkpQ8nfXwQ==} cpu: [arm64] os: [linux] requiresBuild: true optional: true - /@rspack/binding-linux-x64-gnu@1.5.8: - resolution: {integrity: sha512-XLxh5n/pzUfxsugz/8rVBv+Tx2nqEM+9rharK69kfooDsQNKyz7PANllBQ/v4svJ+W0BRHnDL4qXSGdteZeEjA==} + /@rspack/binding-linux-x64-gnu@1.6.0-beta.0: + resolution: {integrity: sha512-xfOzI6+TeLZFJ8I1siOguIlyf5m0ABWPAStPY2Wm4EIEhJz+dr5PTWa5V6DlXZkUfV/6E5ZAQGZmgcgOR+DPHw==} cpu: [x64] os: [linux] requiresBuild: true optional: true - /@rspack/binding-linux-x64-musl@1.5.8: - resolution: {integrity: sha512-gE0+MZmwF+01p9/svpEESkzkLpBkVUG2o03YMpwXYC/maeRRhWvF8BJ7R3i/Ls/jFGSE87dKX5NbRLVzqksq/w==} + /@rspack/binding-linux-x64-musl@1.6.0-beta.0: + resolution: {integrity: sha512-OauuEH2P4ZXQ6vCnNZZocmxUJCTdmyUyZYHBzd+cK62uGzXcGGBp+R74grfmwThL+b4rFI2IupxMCLcDOop0zg==} cpu: [x64] os: [linux] requiresBuild: true optional: true - /@rspack/binding-wasm32-wasi@1.5.8: - resolution: {integrity: sha512-cfg3niNHeJuxuml1Vy9VvaJrI/5TakzoaZvKX2g5S24wfzR50Eyy4JAsZ+L2voWQQp1yMJbmPYPmnTCTxdJQBQ==} + /@rspack/binding-wasm32-wasi@1.6.0-beta.0: + resolution: {integrity: sha512-0sSaIM39lSNthIvZsDA7WDnwdP4/4rRH4QyN4/DLUOCdci5xUSUSz/MsRXA+smI41qu4sh9yU/jRT8pq9bSWAQ==} cpu: [wasm32] requiresBuild: true dependencies: - '@napi-rs/wasm-runtime': 1.0.6 + '@napi-rs/wasm-runtime': 1.0.7 optional: true - /@rspack/binding-win32-arm64-msvc@1.5.8: - resolution: {integrity: sha512-7i3ZTHFXKfU/9Jm9XhpMkrdkxO7lfeYMNVEGkuU5dyBfRMQj69dRgPL7zJwc2plXiqu9LUOl+TwDNTjap7Q36g==} + /@rspack/binding-win32-arm64-msvc@1.6.0-beta.0: + resolution: {integrity: sha512-QqtnwHhpst37I3eQtx1FqpWCQCkigg2M73QUDvjhCE+opb1X46XK+kZOyt5qO0fKRdOgtxTcTVLLzRUWuT4t4A==} cpu: [arm64] os: [win32] requiresBuild: true optional: true - /@rspack/binding-win32-ia32-msvc@1.5.8: - resolution: {integrity: sha512-7ZPPWO11J+soea1+mnfaPpQt7GIodBM7A86dx6PbXgVEoZmetcWPrCF2NBfXxQWOKJ9L3RYltC4z+ZyXRgMOrw==} + /@rspack/binding-win32-ia32-msvc@1.6.0-beta.0: + resolution: {integrity: sha512-Bi8fcihGY8QEgo+u8S3JeD41OLIs1/b4lYYAKOUVmpwJeN0lTlT7oMVikD2bLLpPs+gUkinTeeoUjwx0YWlGlA==} cpu: [ia32] os: [win32] requiresBuild: true optional: true - /@rspack/binding-win32-x64-msvc@1.5.8: - resolution: {integrity: sha512-N/zXQgzIxME3YUzXT8qnyzxjqcnXudWOeDh8CAG9zqTCnCiy16SFfQ/cQgEoLlD9geQntV6jx2GbDDI5kpDGMQ==} + /@rspack/binding-win32-x64-msvc@1.6.0-beta.0: + resolution: {integrity: sha512-h7EltjtoAI2ohKxurD09uoXoe94nHiqcozca4Z7sB+f1RaBnc9U3RmddCVkENGZ2YFDx77fC6bayu2WkdY2YIw==} cpu: [x64] os: [win32] requiresBuild: true optional: true - /@rspack/binding@1.5.8: - resolution: {integrity: sha512-/91CzhRl9r5BIQCgGsS7jA6MDbw1I2BQpbfcUUdkdKl2P79K3Zo/Mw/TvKzS86catwLaUQEgkGRmYawOfPg7ow==} + /@rspack/binding@1.6.0-beta.0: + resolution: {integrity: sha512-8CoJCSkWhhgAcmymvkvXb6fHV1zfRnx68mW/tFD/pN2BzwLrAqzvq9PUhJw0MLq4Dg+RIYG6xjzDDp3fkt574Q==} optionalDependencies: - '@rspack/binding-darwin-arm64': 1.5.8 - '@rspack/binding-darwin-x64': 1.5.8 - '@rspack/binding-linux-arm64-gnu': 1.5.8 - '@rspack/binding-linux-arm64-musl': 1.5.8 - '@rspack/binding-linux-x64-gnu': 1.5.8 - '@rspack/binding-linux-x64-musl': 1.5.8 - '@rspack/binding-wasm32-wasi': 1.5.8 - '@rspack/binding-win32-arm64-msvc': 1.5.8 - '@rspack/binding-win32-ia32-msvc': 1.5.8 - '@rspack/binding-win32-x64-msvc': 1.5.8 - - /@rspack/core@1.5.8: - resolution: {integrity: sha512-sUd2LfiDhqYVfvknuoz0+/c+wSpn693xotnG5g1CSWKZArbtwiYzBIVnNlcHGmuoBRsnj/TkSq8dTQ7gwfBroQ==} + '@rspack/binding-darwin-arm64': 1.6.0-beta.0 + '@rspack/binding-darwin-x64': 1.6.0-beta.0 + '@rspack/binding-linux-arm64-gnu': 1.6.0-beta.0 + '@rspack/binding-linux-arm64-musl': 1.6.0-beta.0 + '@rspack/binding-linux-x64-gnu': 1.6.0-beta.0 + '@rspack/binding-linux-x64-musl': 1.6.0-beta.0 + '@rspack/binding-wasm32-wasi': 1.6.0-beta.0 + '@rspack/binding-win32-arm64-msvc': 1.6.0-beta.0 + '@rspack/binding-win32-ia32-msvc': 1.6.0-beta.0 + '@rspack/binding-win32-x64-msvc': 1.6.0-beta.0 + + /@rspack/core@1.6.0-beta.0: + resolution: {integrity: sha512-wrGg90zjX5/cf2hKh2La0q3++twOBnk6z2WkWWcd1Jz5F9OcbHWyn+9yGHJI921A0AziC0pv7P1MmucmG3e7fA==} engines: {node: '>=18.12.0'} peerDependencies: '@swc/helpers': '>=0.5.1' @@ -11382,17 +11382,17 @@ packages: '@swc/helpers': optional: true dependencies: - '@module-federation/runtime-tools': 0.18.0 - '@rspack/binding': 1.5.8 + '@module-federation/runtime-tools': 0.20.0 + '@rspack/binding': 1.6.0-beta.0 '@rspack/lite-tapable': 1.0.1 - /@rspack/dev-server@1.1.4(@rspack/core@1.5.8)(webpack@5.98.0): + /@rspack/dev-server@1.1.4(@rspack/core@1.6.0-beta.0)(webpack@5.98.0): resolution: {integrity: sha512-kGHYX2jYf3ZiHwVl0aUEPBOBEIG1aWleCDCAi+Jg32KUu3qr/zDUpCEd0wPuHfLEgk0X0xAEYCS6JMO7nBStNQ==} engines: {node: '>= 18.12.0'} peerDependencies: '@rspack/core': '*' dependencies: - '@rspack/core': 1.5.8 + '@rspack/core': 1.6.0-beta.0 chokidar: 3.6.0 http-proxy-middleware: 2.0.9 p-retry: 6.2.0 diff --git a/common/config/subspaces/default/repo-state.json b/common/config/subspaces/default/repo-state.json index 47889341c2b..7d287129e85 100644 --- a/common/config/subspaces/default/repo-state.json +++ b/common/config/subspaces/default/repo-state.json @@ -1,5 +1,5 @@ // DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush. { - "pnpmShrinkwrapHash": "05f30a4fc318c568d5d5a593394d2f615f2f54a1", + "pnpmShrinkwrapHash": "0786622d1159b3ecef516f25da3beac2c0701039", "preferredVersionsHash": "a9b67c38568259823f9cfb8270b31bf6d8470b27" } diff --git a/heft-plugins/heft-rspack-plugin/package.json b/heft-plugins/heft-rspack-plugin/package.json index 5591cd33178..50fd8aabc12 100644 --- a/heft-plugins/heft-rspack-plugin/package.json +++ b/heft-plugins/heft-rspack-plugin/package.json @@ -19,7 +19,7 @@ }, "peerDependencies": { "@rushstack/heft": "^0.75.0", - "@rspack/core": "^1.5.8" + "@rspack/core": "^1.6.0-beta.0" }, "dependencies": { "@rushstack/debug-certificate-manager": "workspace:*", @@ -33,6 +33,6 @@ "@rushstack/terminal": "workspace:*", "eslint": "~9.37.0", "local-node-rig": "workspace:*", - "@rspack/core": "~1.5.8" + "@rspack/core": "~1.6.0-beta.0" } } \ No newline at end of file From 480a8eb8cda8bdd90bcc6c893713340e299b0d51 Mon Sep 17 00:00:00 2001 From: Bharat Middha <5100938+bmiddha@users.noreply.github.com> Date: Fri, 17 Oct 2025 11:44:57 -0700 Subject: [PATCH 24/24] update tests --- .../src/test/SourceMapTest.test.ts | 6 +--- .../__snapshots__/SourceMapTest.test.ts.snap | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 build-tests/heft-rspack-everything-test/src/test/__snapshots__/SourceMapTest.test.ts.snap diff --git a/build-tests/heft-rspack-everything-test/src/test/SourceMapTest.test.ts b/build-tests/heft-rspack-everything-test/src/test/SourceMapTest.test.ts index 52171383838..2c500cdd547 100644 --- a/build-tests/heft-rspack-everything-test/src/test/SourceMapTest.test.ts +++ b/build-tests/heft-rspack-everything-test/src/test/SourceMapTest.test.ts @@ -18,7 +18,6 @@ interface IMapValue { interface IMapTestEntry { name: string; mapRegex: RegExp; - sourceFileRegex: RegExp; map: IMapValue | undefined; } @@ -26,19 +25,16 @@ const mapTests: IMapTestEntry[] = [ { name: 'Test-A', mapRegex: /^heft-test-A_[\w\d]*\.js.map$/, - sourceFileRegex: /indexA\.ts$/, map: undefined }, { name: 'Test-B', mapRegex: /^heft-test-B_[\w\d]*\.js.map$/, - sourceFileRegex: /indexB\.ts$/, map: undefined }, { name: 'Chunk', mapRegex: /^[\w\d\.]*chunk_[\w\d]*\.js.map$/, - sourceFileRegex: /ChunkClass\.ts$/, map: undefined } ]; @@ -114,7 +110,7 @@ function mapValueCheck(entry: IMapTestEntry): void { it(`${entry.name} has a source that matches the sourceFileRegex`, () => { if (map.mapObject.sources) { - expect(map.mapObject.sources).toContainEqual(expect.stringMatching(entry.sourceFileRegex)); + expect(map.mapObject.sources).toMatchSnapshot(); } }); } diff --git a/build-tests/heft-rspack-everything-test/src/test/__snapshots__/SourceMapTest.test.ts.snap b/build-tests/heft-rspack-everything-test/src/test/__snapshots__/SourceMapTest.test.ts.snap new file mode 100644 index 00000000000..23c890d36c4 --- /dev/null +++ b/build-tests/heft-rspack-everything-test/src/test/__snapshots__/SourceMapTest.test.ts.snap @@ -0,0 +1,31 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Source Maps Chunk has a source that matches the sourceFileRegex 1`] = ` +Array [ + "webpack://heft-rspack-everything-test/./lib/chunks/ChunkClass.js", +] +`; + +exports[`Source Maps Test-A has a source that matches the sourceFileRegex 1`] = ` +Array [ + "webpack://heft-rspack-everything-test/webpack/runtime/jsonp_chunk_loading", + "webpack://heft-rspack-everything-test/webpack/runtime/define_property_getters", + "webpack://heft-rspack-everything-test/webpack/runtime/ensure_chunk", + "webpack://heft-rspack-everything-test/webpack/runtime/get javascript chunk filename", + "webpack://heft-rspack-everything-test/webpack/runtime/global", + "webpack://heft-rspack-everything-test/webpack/runtime/has_own_property", + "webpack://heft-rspack-everything-test/webpack/runtime/load_script", + "webpack://heft-rspack-everything-test/webpack/runtime/rspack_version", + "webpack://heft-rspack-everything-test/webpack/runtime/auto_public_path", + "webpack://heft-rspack-everything-test/webpack/runtime/rspack_unique_id", + "webpack://heft-rspack-everything-test/./lib/indexA.js", +] +`; + +exports[`Source Maps Test-B has a source that matches the sourceFileRegex 1`] = ` +Array [ + "webpack://heft-rspack-everything-test/webpack/runtime/rspack_version", + "webpack://heft-rspack-everything-test/webpack/runtime/rspack_unique_id", + "webpack://heft-rspack-everything-test/./lib/indexB.js", +] +`;