Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node: [20.x]
node: [22.x]

runs-on: ${{ matrix.os }}

Expand Down
15 changes: 0 additions & 15 deletions biome.jsonc

This file was deleted.

1 change: 0 additions & 1 deletion client-src/modules/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { FilterTypes } from '@rspack/core';

// biome-ignore lint/suspicious/noExplicitAny: expected any
export type EXPECTED_ANY = any;

export type FilterFunction = (item: string) => boolean;
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"bump": "npx bumpp",
"dev": "rslib -w",
"format": "prettier --write .",
"lint": "biome check .",
"lint:write": "biome check . --write",
"lint": "rslint",
"lint:write": "rslint --fix",
"prettier:ci": "prettier --check .",
"test": "pnpm run test:install && pnpm run build && rstest",
"test:install": "cross-env ./node_modules/.bin/puppeteer browsers install chrome"
Expand All @@ -37,11 +37,11 @@
},
"nano-staged": {
"*.{yaml,yml,json,md,json5}": [
"npm rum format"
"npm run format"
],
"*.{js,jsx,ts,tsx,mjs,cjs}": [
"npm run format",
"biome lint --write --no-errors-on-unmatched"
"rslint --fix"
]
},
"dependencies": {
Expand All @@ -56,9 +56,9 @@
"ws": "^8.19.0"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@hono/node-server": "^1.19.11",
"@rslib/core": "^0.20.0",
"@rslint/core": "^0.3.2",
"@rspack/core": "2.0.0-beta.7",
"@rspack/plugin-react-refresh": "1.6.1",
"@rstest/core": "^0.9.2",
Expand Down
164 changes: 69 additions & 95 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions rslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig, ts } from '@rslint/core';

export default defineConfig([
ts.configs.recommended,
{
rules: {
'@typescript-eslint/no-unused-vars': 'off',
Comment thread
chenjiahan marked this conversation as resolved.
'@typescript-eslint/no-explicit-any': 'off',
},
},
]);
3 changes: 0 additions & 3 deletions rstest.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { version } from '@rspack/core/package.json';
import { defineConfig } from '@rstest/core';

console.log(`Running tests for rspack @${version} \n`);

export default defineConfig({
globals: true,
include: ['tests/*.test.ts', 'tests/e2e/*.test.js'],
Expand Down
34 changes: 6 additions & 28 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ class Server<

try {
stats = fs.lstatSync(fs.realpathSync(item)).isFile();
} catch (error) {
} catch {
// Ignore error
}

Expand Down Expand Up @@ -1203,33 +1203,11 @@ class Server<
#getClientTransport() {
let clientImplementation: string | undefined;
let clientImplementationFound = true;

const isKnownWebSocketServerImplementation =
this.options.webSocketServer &&
typeof (this.options.webSocketServer as WebSocketServerConfiguration)
.type === 'string' &&
// @ts-expect-error
this.options.webSocketServer.type === 'ws';

let clientTransport: string | undefined;

if (this.options.client) {
if (
typeof (this.options.client as DevServerClient).webSocketTransport !==
'undefined'
) {
clientTransport = (this.options.client as DevServerClient)
.webSocketTransport;
} else if (isKnownWebSocketServerImplementation) {
clientTransport = (
this.options.webSocketServer as WebSocketServerConfiguration
).type as string;
} else {
clientTransport = 'ws';
}
} else {
clientTransport = 'ws';
}
let clientTransport =
typeof this.options.client === 'object' &&
this.options.client.webSocketTransport !== 'undefined'
? this.options.client.webSocketTransport
Comment thread
chenjiahan marked this conversation as resolved.
: 'ws';

switch (typeof clientTransport) {
case 'string':
Expand Down
20 changes: 7 additions & 13 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export type {
StatsOptions,
} from '@rspack/core';

// biome-ignore lint/suspicious/noExplicitAny: expected any
export type EXPECTED_ANY = any;

type BasicServer = import('node:net').Server | import('node:tls').Server;
Expand Down Expand Up @@ -136,18 +135,13 @@ export type Middleware =

export type OverlayMessageOptions = boolean | ((error: Error) => void);

// TypeScript overloads for connect-like use
function useFn(fn: NextHandleFunction): BasicApplication;
function useFn(fn: HandleFunction): BasicApplication;
function useFn(route: string, fn: NextHandleFunction): BasicApplication;
function useFn(route: string, fn: HandleFunction): BasicApplication;
function useFn(
routeOrFn: string | NextHandleFunction | HandleFunction,
fn?: NextHandleFunction | HandleFunction,
): BasicApplication {
return {} as BasicApplication;
}
type UseFn = {
(fn: NextHandleFunction): BasicApplication;
(fn: HandleFunction): BasicApplication;
(route: string, fn: NextHandleFunction): BasicApplication;
(route: string, fn: HandleFunction): BasicApplication;
};

export type BasicApplication = {
use: typeof useFn;
use: UseFn;
};
1 change: 0 additions & 1 deletion tests/normalizeOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ async function getAdditionEntries(
const entries = compiler.__internal__builtinPlugins
.filter((p) => p.name === 'EntryPlugin')
.map((p) => p.options)
// biome-ignore lint/suspicious/noExplicitAny: _
.reduce<Record<string, any>>((acc: any, cur: any) => {
const name = cur.options.name;
const request = cur.entry;
Expand Down
Loading