-
-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: table shows the support status of built-in plugins (#6254)
* fix: source map dev tool plugin * docs: improve ProvidePlugin * docs: add webpack license * docs: define plugin * docs: EntryPlugin * fix: ProvidePlugin support process * docs: table for webpack built-plugins status * fix: format * fix: style should be optional * chore: sort by status * fix: notes for ProgressPlugin * Apply suggestions from code review Co-authored-by: fi3ework <fi3ework@gmail.com> --------- Co-authored-by: neverland <jait.chen@foxmail.com> Co-authored-by: fi3ework <fi3ework@gmail.com>
- Loading branch information
1 parent
1cc7de6
commit 0a72d41
Showing
7 changed files
with
289 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
import React from 'react'; | ||
import { Table } from '@builtIns/Table'; | ||
import { useLang } from 'rspress/runtime'; | ||
|
||
enum SupportStatus { | ||
NotSupported, | ||
PartiallySupported, | ||
FullySupported, | ||
} | ||
|
||
const SUPPORT_STATUS_LOCALIZED = { | ||
[SupportStatus.NotSupported]: { | ||
symbol: '🔴', | ||
en: 'Not Supported', | ||
zh: '不支持', | ||
}, | ||
[SupportStatus.PartiallySupported]: { | ||
symbol: '🟡', | ||
en: 'Partially Supported', | ||
zh: '部分支持', | ||
}, | ||
[SupportStatus.FullySupported]: { | ||
symbol: '🟢', | ||
en: 'Fully Supported', | ||
zh: '完全支持', | ||
}, | ||
}; | ||
|
||
interface PluginSupportStatus { | ||
name: string; | ||
status: SupportStatus; | ||
notes?: { | ||
en: string; | ||
zh: string; | ||
}; | ||
} | ||
|
||
const pluginSupportStatusList: PluginSupportStatus[] = [ | ||
{ | ||
name: 'AutomaticPrefetchPlugin', | ||
status: SupportStatus.NotSupported, | ||
}, | ||
{ | ||
name: 'BannerPlugin', | ||
status: SupportStatus.PartiallySupported, | ||
notes: { | ||
en: '`stage` option not supported', | ||
zh: '不支持 `stage` 选项', | ||
}, | ||
}, | ||
{ | ||
name: 'ContextExclusionPlugin', | ||
status: SupportStatus.NotSupported, | ||
}, | ||
{ | ||
name: 'ContextReplacementPlugin', | ||
status: SupportStatus.NotSupported, | ||
}, | ||
{ | ||
name: 'DefinePlugin', | ||
status: SupportStatus.PartiallySupported, | ||
notes: { | ||
en: '`rspack.DefinePlugin.runtimeValue` function not supported', | ||
zh: '不支持 `rspack.DefinePlugin.runtimeValue` 函数', | ||
}, | ||
}, | ||
{ | ||
name: 'DllPlugin', | ||
status: SupportStatus.NotSupported, | ||
}, | ||
{ | ||
name: 'EnvironmentPlugin', | ||
status: SupportStatus.FullySupported, | ||
}, | ||
{ | ||
name: 'EvalSourceMapDevToolPlugin', | ||
status: SupportStatus.PartiallySupported, | ||
notes: { | ||
en: '`test`, `include`, `exclude`, `moduleFilenameTemplate`, `protocol` options not supported', | ||
zh: '不支持 `test`、`include`、`exclude`、`moduleFilenameTemplate`、`protocol` 选项', | ||
}, | ||
}, | ||
{ | ||
name: 'HashedModuleIdsPlugin', | ||
status: SupportStatus.NotSupported, | ||
}, | ||
{ | ||
name: 'HotModuleReplacementPlugin', | ||
status: SupportStatus.FullySupported, | ||
}, | ||
{ | ||
name: 'IgnorePlugin', | ||
status: SupportStatus.FullySupported, | ||
}, | ||
{ | ||
name: 'LimitChunkCountPlugin', | ||
status: SupportStatus.FullySupported, | ||
}, | ||
{ | ||
name: 'MinChunkSizePlugin', | ||
status: SupportStatus.NotSupported, | ||
}, | ||
{ | ||
name: 'ModuleConcatenationPlugin', | ||
status: SupportStatus.FullySupported, | ||
}, | ||
{ | ||
name: 'ModuleFederationPlugin', | ||
status: SupportStatus.FullySupported, | ||
}, | ||
{ | ||
name: 'NoEmitOnErrorsPlugin', | ||
status: SupportStatus.NotSupported, | ||
}, | ||
{ | ||
name: 'NormalModuleReplacementPlugin', | ||
status: SupportStatus.FullySupported, | ||
}, | ||
{ | ||
name: 'PrefetchPlugin', | ||
status: SupportStatus.NotSupported, | ||
}, | ||
{ | ||
name: 'ProfilingPlugin', | ||
status: SupportStatus.NotSupported, | ||
}, | ||
{ | ||
name: 'ProgressPlugin', | ||
status: SupportStatus.PartiallySupported, | ||
notes: { | ||
zh: '仅支持 `profile` 选项', | ||
en: 'Only `profile` option supported', | ||
}, | ||
}, | ||
{ | ||
name: 'ProvidePlugin', | ||
status: SupportStatus.FullySupported, | ||
}, | ||
{ | ||
name: 'SourceMapDevToolPlugin', | ||
status: SupportStatus.FullySupported, | ||
}, | ||
{ | ||
name: 'SplitChunksPlugin', | ||
status: SupportStatus.PartiallySupported, | ||
notes: { | ||
en: '`minSizeReduction`, `usedExports` options not supported', | ||
zh: '不支持 `minSizeReduction`、`usedExports` 选项', | ||
}, | ||
}, | ||
{ | ||
name: 'WatchIgnorePlugin', | ||
status: SupportStatus.NotSupported, | ||
}, | ||
]; | ||
|
||
export const PluginSupportStatusTable: React.FC = () => { | ||
const lang = useLang(); | ||
|
||
return ( | ||
<Table | ||
header={[ | ||
{ | ||
name: lang === 'zh' ? '插件' : 'Plugin', | ||
key: 'name', | ||
}, | ||
{ | ||
name: lang === 'zh' ? '支持情况' : 'Support status', | ||
key: 'status', | ||
style: { | ||
width: '200px', | ||
}, | ||
}, | ||
{ | ||
name: lang === 'zh' ? '备注' : 'Notes', | ||
key: 'notes', | ||
}, | ||
]} | ||
body={pluginSupportStatusList | ||
.sort((a, b) => b.status - a.status) | ||
.map(({ name, status, notes }) => { | ||
const { symbol, en, zh } = SUPPORT_STATUS_LOCALIZED[status]; | ||
const statusText = `${symbol} ${lang === 'zh' ? zh : en}`; | ||
|
||
const notesText = (() => { | ||
if (notes) { | ||
return lang === 'zh' ? notes.zh : notes.en; | ||
} | ||
if (status === SupportStatus.NotSupported) { | ||
return lang === 'zh' ? '待实现' : 'To be implemented'; | ||
} | ||
})(); | ||
|
||
return { | ||
name, | ||
status: statusText, | ||
notes: notesText, | ||
}; | ||
})} | ||
/> | ||
); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Table } from '@builtIns'; | ||
import { PluginSupportStatusTable } from '../../../../components/PluginSupportStatusTable'; | ||
|
||
# Synchronized Built-in Plugins from webpack | ||
|
||
The table below shows the support status of Rspack for the built-in plugins in webpack. If you are interested in participating in the development of plugins or features that have not yet been implemented, we would be very happy to have you join us. | ||
|
||
<PluginSupportStatusTable /> |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Table } from '@builtIns'; | ||
import { PluginSupportStatusTable } from '../../../../components/PluginSupportStatusTable'; | ||
|
||
# 同步自 webpack 的内置插件 | ||
|
||
以下表格展示了 Rspack 相对于 webpack 内置插件的支持情况。对于尚未实现的插件或功能,如果你有兴趣参与开发,我们非常欢迎你来参与。 | ||
|
||
<PluginSupportStatusTable /> |
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