Skip to content

Commit

Permalink
feat: support rspack native plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
LingyuCoder committed Jan 17, 2025
1 parent c47c243 commit 2c83723
Show file tree
Hide file tree
Showing 58 changed files with 2,829 additions and 8 deletions.
22 changes: 22 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ rspack_plugin_progress = { version = "0.2.0", path = "crates/rsp
rspack_plugin_real_content_hash = { version = "0.2.0", path = "crates/rspack_plugin_real_content_hash" }
rspack_plugin_remove_duplicate_modules = { version = "0.2.0", path = "crates/rspack_plugin_remove_duplicate_modules" }
rspack_plugin_remove_empty_chunks = { version = "0.2.0", path = "crates/rspack_plugin_remove_empty_chunks" }
rspack_plugin_rsdoctor = { version = "0.2.0", path = "crates/rspack_plugin_rsdoctor" }
rspack_plugin_runtime = { version = "0.2.0", path = "crates/rspack_plugin_runtime" }
rspack_plugin_runtime_chunk = { version = "0.2.0", path = "crates/rspack_plugin_runtime_chunk" }
rspack_plugin_schemes = { version = "0.2.0", path = "crates/rspack_plugin_schemes" }
Expand Down
1 change: 1 addition & 0 deletions crates/node_binding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ rspack_napi = { workspace = true }
rspack_paths = { workspace = true }
rspack_plugin_html = { workspace = true }
rspack_plugin_javascript = { workspace = true }
rspack_plugin_rsdoctor = { workspace = true }
rspack_util = { workspace = true }

rspack_tracing = { workspace = true }
Expand Down
169 changes: 168 additions & 1 deletion crates/node_binding/binding.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ export declare enum BuiltinPluginName {
LightningCssMinimizerRspackPlugin = 'LightningCssMinimizerRspackPlugin',
BundlerInfoRspackPlugin = 'BundlerInfoRspackPlugin',
CssExtractRspackPlugin = 'CssExtractRspackPlugin',
RsdoctorPlugin = 'RsdoctorPlugin',
JsLoaderRspackPlugin = 'JsLoaderRspackPlugin',
LazyCompilationPlugin = 'LazyCompilationPlugin'
}
Expand Down Expand Up @@ -812,6 +813,157 @@ export interface JsResourceData {
fragment?: string
}

export interface JsRsdoctorAsset {
ukey: number
path: string
chunks: Array<number>
size: number
}

export interface JsRsdoctorAssetPatch {
assets: Array<JsRsdoctorAsset>
chunkAssets: Array<JsRsdoctorChunkAssets>
entrypointAssets: Array<JsRsdoctorEntrypointAssets>
}

export interface JsRsdoctorChunk {
ukey: number
name: string
initial: boolean
entry: boolean
dependencies: Array<number>
imported: Array<number>
}

export interface JsRsdoctorChunkAssets {
chunk: number
assets: Array<number>
}

export interface JsRsdoctorChunkGraph {
chunks: Array<JsRsdoctorChunk>
entrypoints: Array<JsRsdoctorEntrypoint>
}

export interface JsRsdoctorChunkModules {
chunk: number
modules: Array<number>
}

export interface JsRsdoctorDependency {
ukey: number
kind: string
request: string
module: number
dependency: number
}

export interface JsRsdoctorEntrypoint {
ukey: number
name: string
chunks: Array<number>
}

export interface JsRsdoctorEntrypointAssets {
entrypoint: number
assets: Array<number>
}

export interface JsRsdoctorExportInfo {
ukey: number
name: string
from?: number
variable?: number
identifier?: JsRsdoctorStatement
sideEffects: Array<number>
}

export interface JsRsdoctorModule {
ukey: number
identifier: string
path: string
isEntry: boolean
kind: 'normal' | 'concatenated'
layer?: string
dependencies: Array<number>
imported: Array<number>
modules: Array<number>
belongModules: Array<number>
chunks: Array<number>
}

export interface JsRsdoctorModuleGraph {
modules: Array<JsRsdoctorModule>
dependencies: Array<JsRsdoctorDependency>
chunkModules: Array<JsRsdoctorChunkModules>
}

export interface JsRsdoctorModuleGraphModule {
ukey: number
module: number
exports: Array<number>
sideEffects: Array<number>
variables: Array<number>
dynamic: boolean
}

export interface JsRsdoctorModuleId {
module: number
renderId: string
}

export interface JsRsdoctorModuleIdsPatch {
moduleIds: Array<JsRsdoctorModuleId>
}

export interface JsRsdoctorModuleOriginalSource {
module: number
source: string
size: number
}

export interface JsRsdoctorModuleSourcesPatch {
moduleOriginalSources: Array<JsRsdoctorModuleOriginalSource>
}

export interface JsRsdoctorSideEffect {
ukey: number
name: string
originName?: string
module: number
identifier: JsRsdoctorStatement
isNameSpace: boolean
fromDependency?: number
exports: Array<number>
variable?: number
}

export interface JsRsdoctorSourcePosition {
line?: number
column?: number
index?: number
}

export interface JsRsdoctorSourceRange {
start: JsRsdoctorSourcePosition
end?: JsRsdoctorSourcePosition
}

export interface JsRsdoctorStatement {
module: number
sourcePosition?: JsRsdoctorSourceRange
transformedPosition: JsRsdoctorSourceRange
}

export interface JsRsdoctorVariable {
ukey: number
name: string
module: number
usedInfo: string
identififer: JsRsdoctorStatement
exported?: number
}

export interface JsRspackDiagnostic {
severity: JsRspackSeverity
error: JsRspackError
Expand Down Expand Up @@ -1925,6 +2077,11 @@ export interface RawResolveTsconfigOptions {
references?: Array<string>
}

export interface RawRsdoctorPluginOptions {
moduleGraphFeatures: boolean | Array<'graph' | 'ids' | 'sources'>
chunkGraphFeatures: boolean | Array<'graph' | 'assets'>
}

export interface RawRspackFuture {

}
Expand Down Expand Up @@ -2094,7 +2251,12 @@ export declare enum RegisterJsTapKind {
HtmlPluginAlterAssetTagGroups = 37,
HtmlPluginAfterTemplateExecution = 38,
HtmlPluginBeforeEmit = 39,
HtmlPluginAfterEmit = 40
HtmlPluginAfterEmit = 40,
RsdoctorPluginModuleGraph = 41,
RsdoctorPluginChunkGraph = 42,
RsdoctorPluginModuleIds = 43,
RsdoctorPluginModuleSources = 44,
RsdoctorPluginAssets = 45
}

export interface RegisterJsTaps {
Expand Down Expand Up @@ -2139,6 +2301,11 @@ export interface RegisterJsTaps {
registerHtmlPluginAfterTemplateExecutionTaps: (stages: Array<number>) => Array<{ function: ((arg: JsAfterTemplateExecutionData) => JsAfterTemplateExecutionData); stage: number; }>
registerHtmlPluginBeforeEmitTaps: (stages: Array<number>) => Array<{ function: ((arg: JsBeforeEmitData) => JsBeforeEmitData); stage: number; }>
registerHtmlPluginAfterEmitTaps: (stages: Array<number>) => Array<{ function: ((arg: JsAfterEmitData) => JsAfterEmitData); stage: number; }>
registerRsdoctorPluginModuleGraphTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRsdoctorModuleGraph) => Promise<boolean | undefined>); stage: number; }>
registerRsdoctorPluginChunkGraphTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRsdoctorChunkGraph) => Promise<boolean | undefined>); stage: number; }>
registerRsdoctorPluginModuleIdsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRsdoctorModuleIdsPatch) => Promise<boolean | undefined>); stage: number; }>
registerRsdoctorPluginModuleSourcesTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRsdoctorModuleSourcesPatch) => Promise<boolean | undefined>); stage: number; }>
registerRsdoctorPluginAssetsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRsdoctorAssetPatch) => Promise<boolean | undefined>); stage: number; }>
}

export interface ThreadsafeNodeFS {
Expand Down
Loading

0 comments on commit 2c83723

Please sign in to comment.