Skip to content

Commit

Permalink
refactor: use private methods to get client entries
Browse files Browse the repository at this point in the history
  • Loading branch information
LingyuCoder committed Sep 26, 2024
1 parent 728f194 commit 1642bb5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 2 additions & 5 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,7 @@ class Server {
webSocketURLStr = searchParams.toString();
}

additionalEntries.push(
`${this.getClientEntry()}?${webSocketURLStr}`,
);
additionalEntries.push(`${this.getClientEntry()}?${webSocketURLStr}`);
}

const clientHotEntry = this.getClientHotEntry();
Expand Down Expand Up @@ -1676,15 +1674,14 @@ class Server {
}

/**
* @private
* @returns {string}
*/
// eslint-disable-next-line class-methods-use-this
getClientEntry() {
return require.resolve("../client/index.js");
}

/**
* @private
* @returns {string | void}
*/
getClientHotEntry() {
Expand Down
6 changes: 2 additions & 4 deletions types/lib/Server.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1231,15 +1231,13 @@ declare class Server<
*/
private getServerTransport;
/**
* @private
* @returns {string}
*/
private getClientEntry;
getClientEntry(): string;
/**
* @private
* @returns {string | void}
*/
private getClientHotEntry;
getClientHotEntry(): string | void;
/**
* @private
* @returns {void}
Expand Down

0 comments on commit 1642bb5

Please sign in to comment.