Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Upgrade dependencies #7042

Open
wants to merge 6 commits into
base: release/4.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/with-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"@types/react-dom": "^18.0.2",
"express": "^4.19.2",
"tslib": "^2.5.0",
"tsx": "^3.12.1"
"tsx": "3.12.1"
}
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"react-dom": "^18.2.0",
"rimraf": "^3.0.2",
"stylelint": "^15.10.1",
"tsx": "^3.12.1",
"tsx": "3.12.1",
"typescript": "^4.7.4",
"vitest": "^0.15.2"
},
Expand All @@ -71,8 +71,8 @@
"packageManager": "[email protected]",
"pnpm": {
"patchedDependencies": {
"@rspack/[email protected]": "patches/@[email protected].patch",
"[email protected]": "patches/[email protected].patch"
"[email protected]": "patches/[email protected].patch",
"@rspack/[email protected]": "patches/@[email protected].patch"
}
}
}
89 changes: 59 additions & 30 deletions packages/bundles/override/RefreshUtils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
/**
* The following code is modified based on
* https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/0b960573797bf38926937994c481e4fec9ed8aa6/lib/runtime/RefreshUtils.js
*
* MIT Licensed
* Author Michael Mok
* Copyright (c) 2019 Michael Mok
* https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/0b960573797bf38926937994c481e4fec9ed8aa6/LICENSE
*/

/* global __webpack_require__ */
let Refresh = require('react-refresh/runtime');
var Refresh = require('react-refresh/runtime');

/**
* Extracts exports from a webpack module object.
Expand All @@ -14,19 +24,21 @@ function getModuleExports(moduleId) {
// These are likely runtime or dynamically generated modules.
return {};
}
// eslint-disable-next-line
let maybeModule = __webpack_require__.c[moduleId];

var maybeModule = __webpack_require__.c[moduleId];
if (typeof maybeModule === 'undefined') {
// `moduleId` is available but the module in cache is unavailable,
// which indicates the module is somehow corrupted (e.g. broken Webpacak `module` globals).
// We will warn the user (as this is likely a mistake) and assume they cannot be refreshed.
console.warn(`[React Refresh] Failed to get exports for module: ${moduleId}.`);
console.warn(
'[React Refresh] Failed to get exports for module: ' + moduleId + '.',
);
return {};
}

let exportsOrPromise = maybeModule.exports;
var exportsOrPromise = maybeModule.exports;
if (typeof Promise !== 'undefined' && exportsOrPromise instanceof Promise) {
return exportsOrPromise.then((exports) => {
return exportsOrPromise.then(function (exports) {
return exports;
});
}
Expand All @@ -42,15 +54,15 @@ function getModuleExports(moduleId) {
* @returns {string[]} A React refresh boundary signature array.
*/
function getReactRefreshBoundarySignature(moduleExports) {
let signature = [];
var signature = [];
signature.push(Refresh.getFamilyByType(moduleExports));

if (moduleExports == null || typeof moduleExports !== 'object') {
// Exit if we can't iterate over exports.
return signature;
}

for (let key in moduleExports) {
for (var key in moduleExports) {
if (key === '__esModule') {
continue;
}
Expand All @@ -71,7 +83,7 @@ function createDebounceUpdate() {
* A cached setTimeout handler.
* @type {number | undefined}
*/
let refreshTimeout;
var refreshTimeout;

/**
* Performs react refresh on a delay and clears the error overlay.
Expand All @@ -80,7 +92,7 @@ function createDebounceUpdate() {
*/
function enqueueUpdate(callback) {
if (typeof refreshTimeout === 'undefined') {
refreshTimeout = setTimeout(() => {
refreshTimeout = setTimeout(function () {
refreshTimeout = undefined;
Refresh.performReactRefresh();
callback();
Expand Down Expand Up @@ -110,27 +122,34 @@ function isSafeExport(key) {
key === 'staticDataLoader'
);
}

function isReactRefreshBoundary(moduleExports) {
if (Refresh.isLikelyComponentType(moduleExports)) {
return true;
}
if (moduleExports === undefined || moduleExports === null || typeof moduleExports !== 'object') {
if (
moduleExports === undefined ||
moduleExports === null ||
typeof moduleExports !== 'object'
) {
// Exit if we can't iterate over exports.
return false;
}

let hasExports = false;
let areAllExportsComponents = true;
for (let key in moduleExports) {
var hasExports = false;
var areAllExportsComponents = true;
for (var key in moduleExports) {
hasExports = true;

if (isSafeExport(key)) {
continue;
}

// We can (and have to) safely execute getters here,
// as Webpack manually assigns harmony exports to getters,
// without any side-effects attached.
// Ref: https://github.com/webpack/webpack/blob/b93048643fe74de2a6931755911da1212df55897/lib/MainTemplate.js#L281
let exportValue = moduleExports[key];
var exportValue = moduleExports[key];
if (!Refresh.isLikelyComponentType(exportValue)) {
areAllExportsComponents = false;
}
Expand All @@ -150,23 +169,27 @@ function isReactRefreshBoundary(moduleExports) {
function registerExportsForReactRefresh(moduleExports, moduleId) {
if (Refresh.isLikelyComponentType(moduleExports)) {
// Register module.exports if it is likely a component
Refresh.register(moduleExports, `${moduleId} %exports%`);
Refresh.register(moduleExports, moduleId + ' %exports%');
}

if (moduleExports === undefined || moduleExports === null || typeof moduleExports !== 'object') {
if (
moduleExports === undefined ||
moduleExports === null ||
typeof moduleExports !== 'object'
) {
// Exit if we can't iterate over the exports.
return;
}

for (let key in moduleExports) {
for (var key in moduleExports) {
// Skip registering the ES Module indicator
if (key === '__esModule') {
continue;
}

let exportValue = moduleExports[key];
var exportValue = moduleExports[key];
if (Refresh.isLikelyComponentType(exportValue)) {
let typeID = `${moduleId} %exports% ${key}`;
var typeID = moduleId + ' %exports% ' + key;
Refresh.register(exportValue, typeID);
}
}
Expand All @@ -181,14 +204,14 @@ function registerExportsForReactRefresh(moduleExports, moduleId) {
* @returns {boolean} Whether the React refresh boundary should be invalidated.
*/
function shouldInvalidateReactRefreshBoundary(prevExports, nextExports) {
let prevSignature = getReactRefreshBoundarySignature(prevExports);
let nextSignature = getReactRefreshBoundarySignature(nextExports);
var prevSignature = getReactRefreshBoundarySignature(prevExports);
var nextSignature = getReactRefreshBoundarySignature(nextExports);

if (prevSignature.length !== nextSignature.length) {
return true;
}

for (let i = 0; i < nextSignature.length; i += 1) {
for (var i = 0; i < nextSignature.length; i += 1) {
if (prevSignature[i] !== nextSignature[i]) {
return true;
}
Expand All @@ -197,13 +220,19 @@ function shouldInvalidateReactRefreshBoundary(prevExports, nextExports) {
return false;
}

let enqueueUpdate = createDebounceUpdate();
function executeRuntime(moduleExports, moduleId, webpackHot, refreshOverlay, isTest) {
var enqueueUpdate = createDebounceUpdate();
function executeRuntime(
moduleExports,
moduleId,
webpackHot,
refreshOverlay,
isTest,
) {
registerExportsForReactRefresh(moduleExports, moduleId);

if (webpackHot) {
let isHotUpdate = !!webpackHot.data;
let prevExports;
var isHotUpdate = !!webpackHot.data;
var prevExports;
if (isHotUpdate) {
prevExports = webpackHot.data.prevExports;
}
Expand All @@ -216,7 +245,7 @@ function executeRuntime(moduleExports, moduleId, webpackHot, refreshOverlay, isT
* @param {*} data A hot module data object from Webpack HMR.
* @returns {void}
*/
(data) => {
function hotDisposeCallback(data) {
// We have to mutate the data object to get data registered and cached
data.prevExports = moduleExports;
},
Expand All @@ -237,7 +266,7 @@ function executeRuntime(moduleExports, moduleId, webpackHot, refreshOverlay, isT
window.onHotAcceptError(error.message);
}
}
// eslint-disable-next-line

__webpack_require__.c[moduleId].hot.accept(hotErrorHandler);
},
);
Expand All @@ -254,7 +283,7 @@ function executeRuntime(moduleExports, moduleId, webpackHot, refreshOverlay, isT
* A function to dismiss the error overlay after performing React refresh.
* @returns {void}
*/
() => {
function updateCallback() {
if (typeof refreshOverlay !== 'undefined' && refreshOverlay) {
refreshOverlay.clearRuntimeErrors();
}
Expand Down
6 changes: 0 additions & 6 deletions packages/bundles/override/rspack/bindingVersionCheck.js

This file was deleted.

33 changes: 17 additions & 16 deletions packages/bundles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"html-entities": "^2.3.2",
"core-js": "3.32.0",
"caniuse-lite": "^1.0.30001561",
"chokidar": "3.5.3",
"chokidar": "3.6.0",
"esbuild": "^0.17.16",
"events": "3.3.0",
"jest-worker": "27.5.1",
Expand All @@ -45,13 +45,16 @@
"zod": "^3.22.3",
"zod-validation-error": "1.2.0",
"terminal-link": "^2.1.1",
"@ice/pack-binding": "0.0.13",
"mime-types": "2.1.35"
"@ice/pack-binding": "1.1.6",
"mime-types": "2.1.35",
"p-retry": "^6.2.0",
"open": "^10.0.3",
"@rspack/lite-tapable": "1.0.1"
},
"devDependencies": {
"@rspack/plugin-react-refresh": "0.5.7",
"@rspack/dev-server": "0.5.7",
"@rspack/core": "0.5.7",
"@rspack/plugin-react-refresh": "1.0.1",
"@rspack/dev-server": "1.0.10",
"@rspack/core": "1.1.6",
"@types/less": "^3.0.3",
"@types/lodash": "^4.14.181",
"@types/webpack-bundle-analyzer": "^4.4.1",
Expand Down Expand Up @@ -84,9 +87,9 @@
"trusted-cert": "1.1.3",
"webpack": "5.88.2",
"webpack-bundle-analyzer": "4.5.0",
"webpack-dev-server": "4.15.0",
"webpack-dev-server": "5.0.4",
"unplugin": "1.6.0",
"bonjour-service": "^1.0.13",
"bonjour-service": "^1.2.1",
"colorette": "^2.0.10",
"compression": "^1.7.4",
"connect-history-api-fallback": "2.0.0",
Expand All @@ -95,19 +98,17 @@
"graceful-fs": "4.2.10",
"http-proxy-middleware": "^2.0.3",
"ipaddr.js": "^2.0.1",
"open": "^8.0.9",
"p-retry": "^4.5.0",
"portfinder": "^1.0.28",
"rimraf": "^3.0.2",
"schema-utils": "^4.0.0",
"selfsigned": "^2.0.1",
"rimraf": "^5.0.5",
"schema-utils": "^4.2.0",
"selfsigned": "^2.4.1",
"serve-index": "^1.9.1",
"sockjs": "^0.3.21",
"sockjs": "^0.3.24",
"spdy": "^4.0.2",
"webpack-dev-middleware": "^5.3.4",
"webpack-dev-middleware": "^7.1.0",
"ws": "^8.4.2",
"globby": "13.1.2",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.15",
"loader-utils": "^2.0.0",
"source-map": "0.8.0-beta.0",
"find-up": "5.0.0",
Expand Down
Loading
Loading