-
-
Notifications
You must be signed in to change notification settings - Fork 729
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(comment2): rename type to provider
rename type to provider BREAKING CHANGE : rename type to provider
- Loading branch information
1 parent
d096fe2
commit 28410bc
Showing
16 changed files
with
168 additions
and
96 deletions.
There are no files selected for viewing
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
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
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
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,72 @@ | ||
import type { CommentOptions } from "../shared"; | ||
|
||
/** @deprecated */ | ||
export const covertOptions = ( | ||
options: CommentOptions & Record<string, unknown> | ||
): void => { | ||
if ("type" in options) { | ||
console.warn(`"type" is deprecated, please use "provider".`); | ||
if (options["type"] === "waline") options.provider = "Waline"; | ||
else if (options["type"] === "giscus") options.provider = "Giscus"; | ||
else if (options["type"] === "twikoo") options.provider = "Twikoo"; | ||
|
||
delete options["type"]; | ||
} | ||
|
||
// covert Waline options | ||
if (options.provider === "Waline") { | ||
[ | ||
// valine | ||
["emojiCDN", "emoji"], | ||
["emojiMaps", "emoji"], | ||
["requiredFields", "requiredMeta"], | ||
["visitor", "pageview"], | ||
["langMode", "locale"], | ||
["placeholder", "locale.placeholder"], | ||
|
||
// waline v1 | ||
["highlight", "highlighter"], | ||
["uploadImage", "imageUploader"], | ||
["previewMath", "texRenderer"], | ||
["anonymous", "login"], | ||
["copyRight", "copyright"], | ||
].forEach(([oldOptions, newOptions]) => { | ||
if (oldOptions in options) { | ||
console.warn( | ||
`"${oldOptions}" is deprecated in @waline/client@v2, you should use "${newOptions}" instead.` | ||
); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
delete options[oldOptions]; | ||
} | ||
}); | ||
|
||
[ | ||
// valine | ||
"region", | ||
"appId", | ||
"appKey", | ||
"notify", | ||
"verify", | ||
"avatar", | ||
"avatarForce", | ||
"enableQQ", | ||
"recordIP", | ||
"serverURLs", | ||
|
||
// waline v1 | ||
"avatarCDN", | ||
"mathTagSupport", | ||
].forEach((option) => { | ||
if (option in options) { | ||
console.warn( | ||
`"${option}" is no longer supported in @waline/client@v2.` | ||
); | ||
|
||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
delete options[option]; | ||
} | ||
}); | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import type { BaseCommentOptions } from "./base"; | ||
|
||
export interface DisableCommentOptions extends BaseCommentOptions { | ||
type?: "none"; | ||
comment: never; | ||
provider?: "None"; | ||
comment?: never; | ||
} |
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
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
Oops, something went wrong.