-
-
Notifications
You must be signed in to change notification settings - Fork 587
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(typescript): packages/rspack/src/lib from js to ts and esm (#…
…7289) * chore: rename * chore: save progress * refactor(typescript): packages/rspack/src/lib from js to ts and esm * chore: restore the ignoreWarningsPlugin filename * chore: restore * chore: restore EnvironmentPlugin * chore: delete ignoreWarningsPlugin.ts * chore: restore IgnoreWarningsPlugin.ts * chore: rebase * chore: resolve review conversation --------- Co-authored-by: SoonIter <sooniter@gmail.com>
- Loading branch information
Showing
27 changed files
with
2,385 additions
and
2,185 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,3 +103,5 @@ export class NormalModule { | |
return hooks; | ||
} | ||
} | ||
|
||
export default NormalModule; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* The following code is modified based on | ||
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/AbstractMethodError.js | ||
* | ||
* MIT Licensed | ||
* Author Tobias Koppers @sokra | ||
* Copyright (c) JS Foundation and other contributors | ||
* https://github.com/webpack/webpack/blob/main/LICENSE | ||
*/ | ||
|
||
import WebpackError from "./WebpackError"; | ||
|
||
const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/; | ||
|
||
/** | ||
* @param method method name | ||
* @returns message | ||
*/ | ||
function createMessage(method?: string): string { | ||
return `Abstract method${method ? " " + method : ""}. Must be overridden.`; | ||
} | ||
|
||
class Message extends Error { | ||
constructor() { | ||
super(); | ||
this.stack = undefined; | ||
Error.captureStackTrace(this); | ||
const match = this.stack!.split("\n")[3].match(CURRENT_METHOD_REGEXP); | ||
this.message = | ||
match && match[1] ? createMessage(match[1]) : createMessage(); | ||
} | ||
} | ||
|
||
/** | ||
* Error for abstract method | ||
* @example | ||
* class FooClass { | ||
* abstractMethod() { | ||
* throw new AbstractMethodError(); // error message: Abstract method FooClass.abstractMethod. Must be overridden. | ||
* } | ||
* } | ||
* | ||
*/ | ||
export class AbstractMethodError extends WebpackError { | ||
constructor() { | ||
super(new Message().message); | ||
this.name = "AbstractMethodError"; | ||
} | ||
} | ||
|
||
export default AbstractMethodError; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
ebf8483
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ran ecosystem CI: Open
ebf8483
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Benchmark detail: Open