Skip to content

Commit

Permalink
Feat/upgrade rspack (#34)
Browse files Browse the repository at this point in the history
* upgrade rspack and related libs

fix the type error
remove the unused codes
update comments

* chore: remove the unused deps

* chore: upgrade eslint to version 9
  • Loading branch information
xfsnowind authored Dec 27, 2024
1 parent a5dde48 commit 4a4cbef
Show file tree
Hide file tree
Showing 13 changed files with 1,483 additions and 1,870 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

4 changes: 0 additions & 4 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion dist/createRspackDevServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async function createRspackDevServer(config) {
const isOpenMode = !isTextTerminal;
const rspackDevServerConfig = Object.assign(Object.assign({ host: '127.0.0.1', port: 'auto' }, finalRspackConfig.devServer), { devMiddleware: {
publicPath: devServerPublicPathRoute,
stats: (_a = finalRspackConfig.stats) !== null && _a !== void 0 ? _a : 'minimal',
stats: ((_a = finalRspackConfig.stats) !== null && _a !== void 0 ? _a : 'minimal'),
}, hot: false,
// Only enable file watching & reload when executing tests in `open` mode
liveReload: isOpenMode, client: { overlay: false } });
Expand Down
1 change: 0 additions & 1 deletion dist/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ function loader() {
var supportFile = {
absolute: ${supportFileAbsolutePath},
relative: ${supportFileRelativePath},
relativeUrl: "/__cypress/src/cypress-support-file.js",
load: () => import(/* rspackChunkName: "cypress-support-file" */ ${supportFileAbsolutePath}),
}
scriptLoaders.unshift(supportFile)
Expand Down
2 changes: 1 addition & 1 deletion dist/makeDefaultRspackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const OUTPUT_PATH = path_1.default.join(__dirname, 'dist');
const OsSeparatorRE = RegExp(`\\${path_1.default.sep}`, 'g');
const posixSeparator = '/';
function makeCypressRspackConfig(config) {
const { devServerConfig: { cypressConfig: { experimentalJustInTimeCompile, projectRoot, devServerPublicPathRoute, supportFile, indexHtmlFile, isTextTerminal: isRunMode, }, specs: files, devServerEvents, }, sourceRspackModulesResult: { rspack: { module: rspack }, }, } = config;
const { devServerConfig: { cypressConfig: { experimentalJustInTimeCompile, projectRoot, devServerPublicPathRoute, supportFile, indexHtmlFile, isTextTerminal: isRunMode, }, specs: files, devServerEvents, }, } = config;
const optimization = {
// To prevent files from being tree shaken by rspack, we set optimization.sideEffects: false ensuring that
// rspack does not recognize the sideEffects flag in the package.json and thus files are not unintentionally
Expand Down
3 changes: 2 additions & 1 deletion dist/makeRspackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ function modifyRspackConfigForCypress(rspackConfig) {
if (plugin) {
let pluginName = '';
try {
// NOTE: this is to be compatible the old version htmlRspackPlugin, to get its correct name
// NOTE: this is to be compatible the old version HtmlRspackPlugin, to get its correct name
// sth changed for HtmlRspackPlugin in 1.0.1 which would cause the error during calling `raw`
pluginName =
'raw' in plugin ? plugin.raw({ options: { output: {} } }).name : plugin.constructor.name;
}
Expand Down
25 changes: 25 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import tsParser from '@typescript-eslint/parser'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import js from '@eslint/js'
import { FlatCompat } from '@eslint/eslintrc'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

export default [
{
ignores: ['**/dist', '**/node_modules'],
},
...compat.extends('eslint-config-prettier'),
{
languageOptions: {
parser: tsParser,
},
},
]
35 changes: 15 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,41 @@
"test": "jest"
},
"dependencies": {
"@rspack/cli": "1.0.5",
"@rspack/cli": "1.1.8",
"find-up": "6.3.0",
"local-pkg": "0.4.1",
"tslib": "^2.3.1",
"webpack-merge": "^5.10.0"
},
"devDependencies": {
"@babel/core": "^7.24.4",
"@babel/preset-env": "^7.24.4",
"@babel/preset-typescript": "^7.24.1",
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@babel/preset-typescript": "^7.26.0",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.17.0",
"@jest/globals": "^29.7.0",
"@rspack/core": "1.0.5",
"@rspack/dev-server": "1.0.5",
"@rspack/core": "1.1.8",
"@rspack/dev-server": "1.0.10",
"@types/debug": "^4.1.12",
"@types/fs-extra": "^11.0.4",
"@types/jest": "^29.5.12",
"@types/lodash": "^4.17.0",
"@types/proxyquire": "^1.3.31",
"@types/watchpack": "^2.4.4",
"@types/webpack-sources": "^3.2.3",
"@typescript-eslint/parser": "^6.21.0",
"@typescript-eslint/parser": "^8.18.2",
"babel-jest": "^29.7.0",
"cross-env": "^7.0.3",
"cypress": "^13.14.2",
"cypress": "^13.17.0",
"debug": "^4.3.4",
"dedent": "^0.7.0",
"eslint": "^8.57.0",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.0.0",
"fs-extra": "9.1.0",
"jest": "^29.7.0",
"lodash": "^4.17.21",
"path": "^0.12.7",
"prettier": "^3.1.0",
"proxyquire": "2.1.3",
"prettier": "^3.4.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sinon": "^13.0.1",
"snap-shot-it": "^7.9.6",
"ts-node": "^10.9.1",
"typescript": "^5.5.4"
"typescript": "^5.7.2",
"webpack": "5.76.0"
},
"files": [
"dist"
Expand All @@ -75,5 +70,5 @@
"dev-server",
"component test"
],
"packageManager": "pnpm@9.7.1"
"packageManager": "pnpm@9.15.1+sha512.1acb565e6193efbebda772702950469150cf12bcc764262e7587e71d19dc98a423dff9536e57ea44c49bdf790ff694e83c27be5faa23d67e0c033b583be4bfcf"
}
Loading

0 comments on commit 4a4cbef

Please sign in to comment.